diff rust/hg-core/src/config/config.rs @ 48732:d4a5c2197208

rhg: Add parsing for the --color global CLI argument Differential Revision: https://phab.mercurial-scm.org/D12166
author Simon Sapin <simon.sapin@octobus.net>
date Thu, 10 Feb 2022 13:56:43 +0100
parents 1aaf11e35aec
children 39c447e03dbc
line wrap: on
line diff
--- a/rust/hg-core/src/config/config.rs	Thu Feb 10 12:52:25 2022 +0100
+++ b/rust/hg-core/src/config/config.rs	Thu Feb 10 13:56:43 2022 +0100
@@ -139,13 +139,19 @@
         Ok(config)
     }
 
-    pub fn load_cli_args_config(
+    pub fn load_cli_args(
         &mut self,
         cli_config_args: impl IntoIterator<Item = impl AsRef<[u8]>>,
+        color_arg: Option<Vec<u8>>,
     ) -> Result<(), ConfigError> {
         if let Some(layer) = ConfigLayer::parse_cli_args(cli_config_args)? {
             self.layers.push(layer)
         }
+        if let Some(arg) = color_arg {
+            let mut layer = ConfigLayer::new(ConfigOrigin::CommandLineColor);
+            layer.add(b"ui"[..].into(), b"color"[..].into(), arg, None);
+            self.layers.push(layer)
+        }
         Ok(())
     }