-
Notifications
You must be signed in to change notification settings - Fork 286
Add CLI option to disable image #288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ pub struct Cli { | |
pub excluded: Vec<String>, | ||
pub print_languages: bool, | ||
pub true_color: bool, | ||
pub image_off: bool, | ||
} | ||
|
||
impl Cli { | ||
|
@@ -172,12 +173,18 @@ impl Cli { | |
.multiple(true) | ||
.takes_value(true) | ||
.help("Ignore all files & directories matching EXCLUDE."), | ||
) | ||
.arg( | ||
Arg::with_name("off") | ||
.long("off") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we should add |
||
.help("Prevents the ASCII art or image from displaying"), | ||
).get_matches(); | ||
|
||
let no_bold = matches.is_present("no-bold"); | ||
let no_merges = matches.is_present("no-merge-commits"); | ||
let no_color_blocks = matches.is_present("no-color-blocks"); | ||
let print_languages = matches.is_present("languages"); | ||
let image_off = matches.is_present("off"); | ||
let true_color = is_truecolor_terminal(); | ||
|
||
let fields_to_hide: Vec<String> = if let Some(values) = matches.values_of("disable-fields") | ||
|
@@ -248,6 +255,7 @@ impl Cli { | |
excluded, | ||
print_languages, | ||
true_color, | ||
image_off, | ||
}) | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -256,7 +256,11 @@ impl std::fmt::Display for Info { | |
let center_pad = " "; | ||
let mut info_lines = buf.lines(); | ||
|
||
if let Some(custom_image) = &self.config.image { | ||
if self.config.image_off { | ||
while let Some(line) = info_lines.next() { | ||
writeln!(f, "{}", line)?; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think you need to iterate over info_lines, |
||
} else if let Some(custom_image) = &self.config.image { | ||
if let Some(image_backend) = &self.config.image_backend { | ||
writeln!( | ||
f, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As it's not only for images, maybe it would be better to name it
art_off