mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-07 12:05:46 +00:00
Add redundant check for --yes and --no flags conflict
Should be covered by clap, but we're double checking it now
This commit is contained in:
parent
fddc79628a
commit
775e92c52e
11
src/cli.rs
11
src/cli.rs
@ -33,12 +33,11 @@ impl Opts {
|
|||||||
| Subcommand::List { archives: files, .. }) = &mut opts.cmd;
|
| Subcommand::List { archives: files, .. }) = &mut opts.cmd;
|
||||||
*files = canonicalize_files(files)?;
|
*files = canonicalize_files(files)?;
|
||||||
|
|
||||||
let skip_questions_positively = if opts.yes {
|
let skip_questions_positively = match (opts.yes, opts.no) {
|
||||||
QuestionPolicy::AlwaysYes
|
(false, false) => QuestionPolicy::Ask,
|
||||||
} else if opts.no {
|
(true, false) => QuestionPolicy::AlwaysYes,
|
||||||
QuestionPolicy::AlwaysNo
|
(false, true) => QuestionPolicy::AlwaysNo,
|
||||||
} else {
|
(true, true) => unreachable!(),
|
||||||
QuestionPolicy::Ask
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok((opts, skip_questions_positively))
|
Ok((opts, skip_questions_positively))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user