mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-15 08:53:16 +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,
|
||||
args: &ConfigGetArgs,
|
||||
) -> Result<(), CommandError> {
|
||||
let value = command
|
||||
.settings()
|
||||
.get_value(&args.name)
|
||||
.and_then(|value| value.into_string())
|
||||
.map_err(|err| match err {
|
||||
let value = command.settings().get_value(&args.name)?;
|
||||
let stringified = value.into_string().map_err(|err| match err {
|
||||
ConfigError::Type {
|
||||
origin,
|
||||
unexpected,
|
||||
|
@ -75,6 +72,6 @@ pub fn cmd_config_get(
|
|||
}
|
||||
err => err.into(),
|
||||
})?;
|
||||
writeln!(ui.stdout(), "{value}")?;
|
||||
writeln!(ui.stdout(), "{stringified}")?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue