mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-07 12:05:46 +00:00
Replace todo!
with an actual error
This commit is contained in:
parent
c44cdf1013
commit
16ee513906
10
src/cli.rs
10
src/cli.rs
@ -11,7 +11,7 @@ use std::{
|
|||||||
|
|
||||||
use strsim::normalized_damerau_levenshtein;
|
use strsim::normalized_damerau_levenshtein;
|
||||||
|
|
||||||
use crate::{arg_flag, flag, oof, Error};
|
use crate::{arg_flag, error::FinalError, flag, oof, Error};
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, Debug)]
|
#[derive(PartialEq, Eq, Debug)]
|
||||||
pub enum Command {
|
pub enum Command {
|
||||||
@ -47,7 +47,13 @@ pub fn parse_args() -> crate::Result<ParsedArgs> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if parsed_args.flags.is_present("yes") && parsed_args.flags.is_present("no") {
|
if parsed_args.flags.is_present("yes") && parsed_args.flags.is_present("no") {
|
||||||
todo!("conflicting flags, better error message.");
|
return Err(Error::Custom {
|
||||||
|
reason: FinalError::with_title("Conflicted flags detected.")
|
||||||
|
.detail("You can't use both --yes and --no at the same time.")
|
||||||
|
.hint("Use --yes if you want to positively skip overwrite questions")
|
||||||
|
.hint("Use --no if you want to negatively skip overwrite questions")
|
||||||
|
.hint("Don't use either if you want to be asked each time"),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(parsed_args)
|
Ok(parsed_args)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user