comparison 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
comparison
equal deleted inserted replaced
48731:f591b377375f 48732:d4a5c2197208
137 } 137 }
138 } 138 }
139 Ok(config) 139 Ok(config)
140 } 140 }
141 141
142 pub fn load_cli_args_config( 142 pub fn load_cli_args(
143 &mut self, 143 &mut self,
144 cli_config_args: impl IntoIterator<Item = impl AsRef<[u8]>>, 144 cli_config_args: impl IntoIterator<Item = impl AsRef<[u8]>>,
145 color_arg: Option<Vec<u8>>,
145 ) -> Result<(), ConfigError> { 146 ) -> Result<(), ConfigError> {
146 if let Some(layer) = ConfigLayer::parse_cli_args(cli_config_args)? { 147 if let Some(layer) = ConfigLayer::parse_cli_args(cli_config_args)? {
148 self.layers.push(layer)
149 }
150 if let Some(arg) = color_arg {
151 let mut layer = ConfigLayer::new(ConfigOrigin::CommandLineColor);
152 layer.add(b"ui"[..].into(), b"color"[..].into(), arg, None);
147 self.layers.push(layer) 153 self.layers.push(layer)
148 } 154 }
149 Ok(()) 155 Ok(())
150 } 156 }
151 157