allow decimals/floats to be formatted with precision (#449)

* allow decimals/floats to be formatted with precision

* better error message
This commit is contained in:
Darren Schroeder
2021-12-07 14:06:14 -06:00
committed by GitHub
parent 11a781fc36
commit 8d027a0617
2 changed files with 33 additions and 2 deletions

View File

@ -13,6 +13,7 @@ pub struct Config {
pub use_grid_icons: bool,
pub footer_mode: FooterMode,
pub animate_prompt: bool,
pub float_precision: i64,
}
impl Default for Config {
@ -25,6 +26,7 @@ impl Default for Config {
use_grid_icons: false,
footer_mode: FooterMode::Never,
animate_prompt: ANIMATE_PROMPT_DEFAULT,
float_precision: 4,
}
}
}
@ -83,9 +85,12 @@ impl Value {
}
"animate_prompt" => {
let val = value.as_bool()?;
config.animate_prompt = val;
}
"float_precision" => {
let val = value.as_integer()?;
config.float_precision = val;
}
_ => {}
}
}