Skip to content

Commit f705b01

Browse files
committed
Implement suggestions
Renames `image_off` to `art_off` since it will not only turn of images, removes unnecessary iteration while printing, and defines conflicting CLI arguments for `--off`.
1 parent 0d4aa2f commit f705b01

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

Diff for: src/onefetch/cli.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub struct Cli {
2323
pub excluded: Vec<String>,
2424
pub print_languages: bool,
2525
pub true_color: bool,
26-
pub image_off: bool,
26+
pub art_off: bool,
2727
}
2828

2929
impl Cli {
@@ -177,14 +177,15 @@ impl Cli {
177177
.arg(
178178
Arg::with_name("off")
179179
.long("off")
180-
.help("Prevents the ASCII art or image from displaying"),
180+
.help("Prevents the ASCII art or image from displaying")
181+
.conflicts_with_all(&["image", "ascii-language", "ascii-input"]),
181182
).get_matches();
182183

183184
let no_bold = matches.is_present("no-bold");
184185
let no_merges = matches.is_present("no-merge-commits");
185186
let no_color_blocks = matches.is_present("no-color-blocks");
186187
let print_languages = matches.is_present("languages");
187-
let image_off = matches.is_present("off");
188+
let art_off = matches.is_present("off");
188189
let true_color = is_truecolor_terminal();
189190

190191
let fields_to_hide: Vec<String> = if let Some(values) = matches.values_of("disable-fields")
@@ -255,7 +256,7 @@ impl Cli {
255256
excluded,
256257
print_languages,
257258
true_color,
258-
image_off,
259+
art_off,
259260
})
260261
}
261262

Diff for: src/onefetch/info.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -256,10 +256,8 @@ impl std::fmt::Display for Info {
256256
let center_pad = " ";
257257
let mut info_lines = buf.lines();
258258

259-
if self.config.image_off {
260-
while let Some(line) = info_lines.next() {
261-
writeln!(f, "{}", line)?;
262-
}
259+
if self.config.art_off {
260+
writeln!(f, "{}", buf)?;
263261
} else if let Some(custom_image) = &self.config.image {
264262
if let Some(image_backend) = &self.config.image_backend {
265263
writeln!(

0 commit comments

Comments
 (0)