forked from mirrors/jj
cli_util: make resolve_aliases()
take only settings, not whole ui
This commit is contained in:
parent
8d7a9e729b
commit
c7b90bbe1c
1 changed files with 3 additions and 4 deletions
|
@ -1246,7 +1246,7 @@ fn string_list_from_config(value: config::Value) -> Option<Vec<String>> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn resolve_aliases(
|
fn resolve_aliases(
|
||||||
ui: &mut Ui,
|
user_settings: &UserSettings,
|
||||||
app: &clap::Command,
|
app: &clap::Command,
|
||||||
string_args: &[String],
|
string_args: &[String],
|
||||||
) -> Result<Vec<String>, CommandError> {
|
) -> Result<Vec<String>, CommandError> {
|
||||||
|
@ -1275,8 +1275,7 @@ fn resolve_aliases(
|
||||||
r#"Recursive alias definition involving "{alias_name}""#
|
r#"Recursive alias definition involving "{alias_name}""#
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
match ui
|
match user_settings
|
||||||
.settings()
|
|
||||||
.config()
|
.config()
|
||||||
.get::<config::Value>(&format!("alias.{}", alias_name))
|
.get::<config::Value>(&format!("alias.{}", alias_name))
|
||||||
{
|
{
|
||||||
|
@ -1322,7 +1321,7 @@ pub fn parse_args(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let string_args = resolve_aliases(ui, &app, &string_args)?;
|
let string_args = resolve_aliases(ui.settings(), &app, &string_args)?;
|
||||||
let matches = app.clone().try_get_matches_from(&string_args)?;
|
let matches = app.clone().try_get_matches_from(&string_args)?;
|
||||||
|
|
||||||
let mut args: Args = Args::from_arg_matches(&matches).unwrap();
|
let mut args: Args = Args::from_arg_matches(&matches).unwrap();
|
||||||
|
|
Loading…
Reference in a new issue