mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-18 02:04:19 +00:00
aliases: when invalid command found, let clap
handle it
When we resolve aliases and we try to resolve something that is not a real command and not an alias, we currently replicate `clap`'s error message. I don't know why I did that because it seems that we should just stop resolving aliases and let `clap` try to parse what we have resolved at that point. This patch makes that change, thereby removing an additional call to `process::exit()`.
This commit is contained in:
parent
0484573a6d
commit
cc30cb6ca8
1 changed files with 2 additions and 4 deletions
|
@ -1224,10 +1224,8 @@ fn resolve_aliases(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(config::ConfigError::NotFound(_)) => {
|
Err(config::ConfigError::NotFound(_)) => {
|
||||||
let mut app = app.clone();
|
// Not a real command and not an alias, so return what we've resolved so far
|
||||||
app.error(clap::ErrorKind::ArgumentNotFound, format!(
|
return Ok(string_args);
|
||||||
r#"Found argument '{alias_name}' which wasn't expected, or isn't valid in this context"#
|
|
||||||
)).exit();
|
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
return Err(CommandError::from(err));
|
return Err(CommandError::from(err));
|
||||||
|
|
Loading…
Reference in a new issue