mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-02 09:52:10 +00:00
Change with_toml_strings
to incorporate_toml_string
It makes more sense for this function to change `self`.
This commit is contained in:
parent
95637e252c
commit
e8b21c5ce0
2 changed files with 8 additions and 10 deletions
|
@ -45,21 +45,18 @@ impl UserSettings {
|
|||
UserSettings { config, timestamp }
|
||||
}
|
||||
|
||||
pub fn with_toml_strings(
|
||||
&self,
|
||||
pub fn incorporate_toml_strings(
|
||||
&mut self,
|
||||
toml_strs: &[String],
|
||||
) -> Result<UserSettings, config::ConfigError> {
|
||||
) -> Result<(), config::ConfigError> {
|
||||
let mut config_builder = config::Config::builder().add_source(self.config.clone());
|
||||
for s in toml_strs {
|
||||
config_builder =
|
||||
config_builder.add_source(config::File::from_str(s, config::FileFormat::Toml));
|
||||
}
|
||||
let new_config = config_builder.build()?;
|
||||
let timestamp = get_timestamp_config(&new_config, "user.timestamp");
|
||||
Ok(UserSettings {
|
||||
config: new_config,
|
||||
timestamp,
|
||||
})
|
||||
self.config = config_builder.build()?;
|
||||
self.timestamp = get_timestamp_config(&self.config, "user.timestamp");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn with_repo(&self, repo_path: &Path) -> Result<RepoSettings, config::ConfigError> {
|
||||
|
|
|
@ -1590,7 +1590,8 @@ fn handle_early_args(
|
|||
ui.set_pagination(crate::ui::PaginationChoice::No);
|
||||
}
|
||||
if !args.config_toml.is_empty() {
|
||||
let settings = ui.settings().with_toml_strings(&args.config_toml)?;
|
||||
let mut settings = ui.settings().clone();
|
||||
settings.incorporate_toml_strings(&args.config_toml)?;
|
||||
ui.reset(settings);
|
||||
}
|
||||
Ok(())
|
||||
|
|
Loading…
Reference in a new issue