Skip to content

Commit 949db39

Browse files
committed
Merge branch 'master' into remove-panic-from-info-fmt
2 parents 4fcc458 + 2b2aeaa commit 949db39

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

src/onefetch/cli.rs

+8-11
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,10 @@ impl Cli {
147147
Arg::with_name("color-resolution")
148148
.long("color-resolution")
149149
.value_name("VALUE")
150+
.requires("image")
150151
.takes_value(true)
151152
.max_values(1)
152153
.possible_values(&["16", "32", "64", "128", "256"])
153-
.default_value("16")
154154
.help("VALUE of color resolution to use with SIXEL backend."),
155155
)
156156
.arg(
@@ -231,11 +231,12 @@ impl Cli {
231231
if image.is_some() && image_backend.is_none() {
232232
return Err("Could not detect a supported image backend".into());
233233
}
234-
let image_colors: usize = matches
235-
.value_of("color-resolution")
236-
.unwrap()
237-
.parse()
238-
.unwrap();
234+
235+
let image_colors = if let Some(value) = matches.value_of("color-resolution") {
236+
usize::from_str(value).unwrap()
237+
} else {
238+
16
239+
};
239240

240241
let path = String::from(matches.value_of("input").unwrap());
241242

@@ -255,11 +256,7 @@ impl Cli {
255256

256257
let disabled_fields = info_fields::get_disabled_fields(fields_to_hide)?;
257258

258-
let number_of_authors = if let Some(value) = matches.value_of("authors-number") {
259-
usize::from_str(value).unwrap()
260-
} else {
261-
3
262-
};
259+
let number_of_authors: usize = matches.value_of("authors-number").unwrap().parse().unwrap();
263260

264261
let excluded = if let Some(user_ignored) = matches.values_of("exclude") {
265262
user_ignored.map(String::from).collect()

0 commit comments

Comments
 (0)