mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-15 16:53:25 +00:00
cli: config get: break method chaining for ease of error type migration
.get_value() doesn't do type casting, so a Type error wouldn't occur.
This commit is contained in:
parent
ba739b2f76
commit
c3a8fb9f37
1 changed files with 25 additions and 28 deletions
|
@ -47,11 +47,8 @@ pub fn cmd_config_get(
|
||||||
command: &CommandHelper,
|
command: &CommandHelper,
|
||||||
args: &ConfigGetArgs,
|
args: &ConfigGetArgs,
|
||||||
) -> Result<(), CommandError> {
|
) -> Result<(), CommandError> {
|
||||||
let value = command
|
let value = command.settings().get_value(&args.name)?;
|
||||||
.settings()
|
let stringified = value.into_string().map_err(|err| match err {
|
||||||
.get_value(&args.name)
|
|
||||||
.and_then(|value| value.into_string())
|
|
||||||
.map_err(|err| match err {
|
|
||||||
ConfigError::Type {
|
ConfigError::Type {
|
||||||
origin,
|
origin,
|
||||||
unexpected,
|
unexpected,
|
||||||
|
@ -75,6 +72,6 @@ pub fn cmd_config_get(
|
||||||
}
|
}
|
||||||
err => err.into(),
|
err => err.into(),
|
||||||
})?;
|
})?;
|
||||||
writeln!(ui.stdout(), "{value}")?;
|
writeln!(ui.stdout(), "{stringified}")?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue