Skip to content

Commit 9616e79

Browse files
committed
default to auto
Signed-off-by: Luke-zhang-04 <[email protected]>
1 parent d4ce353 commit 9616e79

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/onefetch/cli.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,6 @@ impl Cli {
232232
.takes_value(true)
233233
.max_values(1)
234234
.multiple(false)
235-
.default_value("auto")
236235
.possible_values(&["auto", "true", "false"])
237236
.help("Will hide the logo if true. If set to auto, the logo will be hidden if the terminal size is too small. If set to false, the logo will be shown no matter what.")
238237
.conflicts_with("off")
@@ -295,6 +294,18 @@ impl Cli {
295294
art_off = false;
296295
}
297296
}
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+
}
298309
}
299310

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

0 commit comments

Comments
 (0)