Skip to content

Commit 39e6f61

Browse files
committed
refactor: get rid of duplicate code
Signed-off-by: Luke-zhang-04 <[email protected]>
1 parent 9616e79 commit 39e6f61

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

Diff for: src/onefetch/cli.rs

+2-14
Original file line numberDiff line numberDiff line change
@@ -277,12 +277,12 @@ impl Cli {
277277
None
278278
};
279279

280-
if let Some(should_hide_logo) = matches.value_of("hide-logo") {
280+
if let Some(should_hide_logo) = matches.value_of("hide-logo").or(Some("auto")) {
281281
if should_hide_logo == "true" {
282282
art_off = true;
283283
} else if should_hide_logo == "false" {
284284
art_off = false;
285-
} else {
285+
} else if !art_off {
286286
if let Some((width, _)) = term_size::dimensions_stdout() {
287287
art_off = width <= max_term_size;
288288
} else {
@@ -294,18 +294,6 @@ impl Cli {
294294
art_off = false;
295295
}
296296
}
297-
} else if !art_off {
298-
// Default to auto without setting it in the CLI args
299-
if let Some((width, _)) = term_size::dimensions_stdout() {
300-
art_off = width <= max_term_size;
301-
} else {
302-
std::println!(
303-
"{}",
304-
("Coult not get terminal width. ASCII art will be displayed.").yellow(),
305-
);
306-
307-
art_off = false;
308-
}
309297
}
310298

311299
if image.is_some() && image_backend.is_none() {

0 commit comments

Comments
 (0)