add requires param to color-resolution flag
@@ -146,10 +146,10 @@ impl Cli {
Arg::with_name("color-resolution")
.long("color-resolution")
.value_name("VALUE")
+ .requires("image")
.takes_value(true)
.max_values(1)
.possible_values(&["16", "32", "64", "128", "256"])
- .default_value("16")
.help("VALUE of color resolution to use with SIXEL backend."),
)
.arg(
@@ -226,11 +226,11 @@ impl Cli {
None
};
- let image_colors: usize = matches
- .value_of("color-resolution")
- .unwrap()
- .parse()
- .unwrap();
+ let image_colors = if let Some(value) = matches.value_of("color-resolution") {
+ usize::from_str(value).unwrap()
+ } else {
+ 16
+ };
let path = String::from(matches.value_of("input").unwrap());
@@ -250,11 +250,7 @@ impl Cli {
let disabled_fields = info_fields::get_disabled_fields(fields_to_hide)?;
- let number_of_authors = if let Some(value) = matches.value_of("authors-number") {
- usize::from_str(value).unwrap()
- } else {
- 3
- };
+ let number_of_authors: usize = matches.value_of("authors-number").unwrap().parse().unwrap();
let excluded = if let Some(user_ignored) = matches.values_of("exclude") {
user_ignored.map(String::from).collect()
