default flag behavior now correctly handles empty variable
This commit is contained in:
parent
90e5eb8f79
commit
0773529ba5
1 changed files with 6 additions and 1 deletions
|
@ -51,7 +51,12 @@ fn main() {
|
||||||
|
|
||||||
let state = State::new(&mut args);
|
let state = State::new(&mut args);
|
||||||
|
|
||||||
let subcommand = if let Ok(Some(subcommand)) = args.subcommand() { Some(subcommand) } else { var("PRIDE_DEFAULT").ok() };
|
let subcommand =
|
||||||
|
if let Ok(Some(subcommand)) = args.subcommand() { Some(subcommand) }
|
||||||
|
else if let Ok(default) = var("PRIDE_DEFAULT") {
|
||||||
|
if default.is_empty() { None }
|
||||||
|
else { Some(default) }
|
||||||
|
} else { None };
|
||||||
let variant = args.subcommand().unwrap();
|
let variant = args.subcommand().unwrap();
|
||||||
|
|
||||||
// get color vec from matched flag
|
// get color vec from matched flag
|
||||||
|
|
Loading…
Reference in a new issue