mirror of
https://github.com/jj-vcs/jj.git
synced 2025-12-23 06:01:01 +00:00
cli: remove deprecated --config-toml flag
This commit is contained in:
parent
2fe06ed45f
commit
15c673459f
5 changed files with 7 additions and 49 deletions
|
|
@ -19,6 +19,9 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|||
* The deprecated `Signature.username()` template method has been removed. Use
|
||||
`Signature.email().local()` instead.
|
||||
|
||||
* The deprecated `--config-toml` flag has been removed. Use
|
||||
`--config=NAME=VALUE` or `--config-file=PATH` instead.
|
||||
|
||||
### Deprecations
|
||||
|
||||
* The on-disk index format has changed. `jj` will write index files in both old
|
||||
|
|
|
|||
|
|
@ -3267,10 +3267,6 @@ pub struct EarlyArgs {
|
|||
/// TOML constructs (such as array notation), quotes can be omitted.
|
||||
#[arg(long, value_name = "NAME=VALUE", global = true, add = ArgValueCompleter::new(complete::leaf_config_key_value))]
|
||||
pub config: Vec<String>,
|
||||
/// Additional configuration options (can be repeated) (DEPRECATED)
|
||||
// TODO: delete --config-toml in jj 0.31+
|
||||
#[arg(long, value_name = "TOML", global = true, hide = true)]
|
||||
pub config_toml: Vec<String>,
|
||||
/// Additional configuration files (can be repeated)
|
||||
#[arg(long, value_name = "PATH", global = true, value_hint = clap::ValueHint::FilePath)]
|
||||
pub config_file: Vec<String>,
|
||||
|
|
@ -3280,14 +3276,9 @@ impl EarlyArgs {
|
|||
pub(crate) fn merged_config_args(&self, matches: &ArgMatches) -> Vec<(ConfigArgKind, &str)> {
|
||||
merge_args_with(
|
||||
matches,
|
||||
&[
|
||||
("config", &self.config),
|
||||
("config_toml", &self.config_toml),
|
||||
("config_file", &self.config_file),
|
||||
],
|
||||
&[("config", &self.config), ("config_file", &self.config_file)],
|
||||
|id, value| match id {
|
||||
"config" => (ConfigArgKind::Item, value.as_ref()),
|
||||
"config_toml" => (ConfigArgKind::Toml, value.as_ref()),
|
||||
"config_file" => (ConfigArgKind::File, value.as_ref()),
|
||||
_ => unreachable!("unexpected id {id:?}"),
|
||||
},
|
||||
|
|
@ -3295,7 +3286,7 @@ impl EarlyArgs {
|
|||
}
|
||||
|
||||
fn has_config_args(&self) -> bool {
|
||||
!self.config.is_empty() || !self.config_toml.is_empty() || !self.config_file.is_empty()
|
||||
!self.config.is_empty() || !self.config_file.is_empty()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3876,12 +3867,6 @@ impl<'a> CliRunner<'a> {
|
|||
migrate_config(&mut config)?;
|
||||
ui.reset(&config)?;
|
||||
}
|
||||
if !args.config_toml.is_empty() {
|
||||
writeln!(
|
||||
ui.warning_default(),
|
||||
"--config-toml is deprecated; use --config or --config-file instead."
|
||||
)?;
|
||||
}
|
||||
|
||||
if args.has_config_args() {
|
||||
warn_if_args_mismatch(ui, &self.app, &config, &string_args)?;
|
||||
|
|
|
|||
|
|
@ -992,7 +992,6 @@ fn get_jj_command() -> Result<(JjBuilder, UserSettings), CommandError> {
|
|||
for (kind, value) in args.early_args.merged_config_args(&arg_matches) {
|
||||
let arg = match kind {
|
||||
ConfigArgKind::Item => format!("--config={value}"),
|
||||
ConfigArgKind::Toml => format!("--config-toml={value}"),
|
||||
ConfigArgKind::File => format!("--config-file={value}"),
|
||||
};
|
||||
cmd_args.push(arg);
|
||||
|
|
|
|||
|
|
@ -530,7 +530,7 @@ fn config_files_for(
|
|||
/// 4. Repo config `.jj/repo/config.toml`
|
||||
/// 5. TODO: Workspace config `.jj/config.toml`
|
||||
/// 6. Override environment variables
|
||||
/// 7. Command-line arguments `--config`, `--config-toml`, `--config-file`
|
||||
/// 7. Command-line arguments `--config` and `--config-file`
|
||||
///
|
||||
/// This function sets up 1, 2, and 6.
|
||||
pub fn config_from_environment(default_layers: impl IntoIterator<Item = ConfigLayer>) -> RawConfig {
|
||||
|
|
@ -633,8 +633,6 @@ fn env_overrides_layer() -> ConfigLayer {
|
|||
pub enum ConfigArgKind {
|
||||
/// `--config=NAME=VALUE`
|
||||
Item,
|
||||
/// `--config-toml=TOML`
|
||||
Toml,
|
||||
/// `--config-file=PATH`
|
||||
File,
|
||||
}
|
||||
|
|
@ -659,11 +657,6 @@ pub fn parse_config_args(
|
|||
}
|
||||
layers.push(layer);
|
||||
}
|
||||
ConfigArgKind::Toml => {
|
||||
for (_, text) in chunk {
|
||||
layers.push(ConfigLayer::parse(source, text)?);
|
||||
}
|
||||
}
|
||||
ConfigArgKind::File => {
|
||||
for (_, path) in chunk {
|
||||
layers.push(ConfigLayer::load_from_file(source, path.into())?);
|
||||
|
|
|
|||
|
|
@ -705,14 +705,6 @@ fn test_config_args() {
|
|||
test.key1 = "arg1"
|
||||
[EOF]
|
||||
"#);
|
||||
let output = list_config(&["--config-toml=test.key1='arg1'"]);
|
||||
insta::assert_snapshot!(output, @r"
|
||||
test.key1 = 'arg1'
|
||||
[EOF]
|
||||
------- stderr -------
|
||||
Warning: --config-toml is deprecated; use --config or --config-file instead.
|
||||
[EOF]
|
||||
");
|
||||
let output = list_config(&["--config-file=file1.toml"]);
|
||||
insta::assert_snapshot!(output, @r"
|
||||
test.key1 = 'file1'
|
||||
|
|
@ -736,30 +728,16 @@ fn test_config_args() {
|
|||
let output = list_config(&[
|
||||
"--config=test.key1=arg1",
|
||||
"--config-file=file1.toml",
|
||||
"--config-toml=test.key2='arg3'",
|
||||
"--config-file=file2.toml",
|
||||
]);
|
||||
insta::assert_snapshot!(output, @r##"
|
||||
# test.key1 = "arg1"
|
||||
test.key1 = 'file1'
|
||||
# test.key2 = 'file1'
|
||||
test.key2 = 'arg3'
|
||||
test.key2 = 'file1'
|
||||
test.key3 = 'file2'
|
||||
[EOF]
|
||||
------- stderr -------
|
||||
Warning: --config-toml is deprecated; use --config or --config-file instead.
|
||||
[EOF]
|
||||
"##);
|
||||
|
||||
let output = test_env.run_jj_in(".", ["config", "list", "foo", "--config-toml=foo='bar'"]);
|
||||
insta::assert_snapshot!(output, @r"
|
||||
foo = 'bar'
|
||||
[EOF]
|
||||
------- stderr -------
|
||||
Warning: --config-toml is deprecated; use --config or --config-file instead.
|
||||
[EOF]
|
||||
");
|
||||
|
||||
let output = test_env.run_jj_in(".", ["config", "list", "--config=foo"]);
|
||||
insta::assert_snapshot!(output, @r"
|
||||
------- stderr -------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue