From a7339244b8633b13660284ec8cc95a6883cea7a5 Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Sun, 1 Dec 2024 14:21:01 +0900 Subject: [PATCH] ui: define default ui.quiet and .progress-indicator in config/misc.toml --- CHANGELOG.md | 3 +++ cli/src/config/misc.toml | 2 ++ cli/src/ui.rs | 8 ++++---- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb23c0841..5fd02ba61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,9 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ### Breaking changes +* The following configuration variables are now parsed strictly: + `ui.progress-indicator`, `ui.quiet` + ### Deprecations ### New features diff --git a/cli/src/config/misc.toml b/cli/src/config/misc.toml index 0a5ac585c..dc370e919 100644 --- a/cli/src/config/misc.toml +++ b/cli/src/config/misc.toml @@ -21,6 +21,8 @@ diff-instructions = true graph.style = "curved" paginate = "auto" pager = { command = ["less", "-FRX"], env = { LESSCHARSET = "utf-8" } } +progress-indicator = true +quiet = false log-word-wrap = false log-synthetic-elided-nodes = true conflict-marker-style = "diff" diff --git a/cli/src/ui.rs b/cli/src/ui.rs index 7201b3616..a1df2066a 100644 --- a/cli/src/ui.rs +++ b/cli/src/ui.rs @@ -339,20 +339,20 @@ impl Ui { pub fn with_config(config: &StackedConfig) -> Result { let formatter_factory = prepare_formatter_factory(config, &io::stdout())?; Ok(Ui { - quiet: config.get("ui.quiet").unwrap_or_default(), + quiet: config.get("ui.quiet")?, formatter_factory, pager_cmd: config.get("ui.pager")?, paginate: config.get("ui.paginate")?, - progress_indicator: config.get("ui.progress-indicator").unwrap_or(true), + progress_indicator: config.get("ui.progress-indicator")?, output: UiOutput::new_terminal(), }) } pub fn reset(&mut self, config: &StackedConfig) -> Result<(), CommandError> { - self.quiet = config.get("ui.quiet").unwrap_or_default(); + self.quiet = config.get("ui.quiet")?; self.paginate = config.get("ui.paginate")?; self.pager_cmd = config.get("ui.pager")?; - self.progress_indicator = config.get("ui.progress-indicator").unwrap_or(true); + self.progress_indicator = config.get("ui.progress-indicator")?; self.formatter_factory = prepare_formatter_factory(config, &io::stdout())?; Ok(()) }