diff options
| author | tv <tv@krebsco.de> | 2026-11-29 01:24:49 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-29 01:24:49 +0000 |
| commit | f568d97b7ad41bdeeb4d07c61fad468bc83ad3f6 (patch) | |
| tree | 4176b4be5bb27fcc6108a0c32c2da4376576a15f /crates/config/src/arguments.rs | |
| parent | f10ee79ddc2b0a541f1011aa395990df21e456b5 (diff) | |
config: clap, serde, toml and tracing are features, none default
A program names what it uses of the crate:
* clap: the command line (arguments);
* serde: what the values set are read into (layer::read), and
durations and sizes as fields (units::duration_option, …);
* toml: configuration files in TOML; without it a .toml file is
refused, saying so, and files are JSON;
* tracing: what a source replaces of an earlier one's, logged.
continuum names all four.
Diffstat (limited to 'crates/config/src/arguments.rs')
| -rw-r--r-- | crates/config/src/arguments.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/crates/config/src/arguments.rs b/crates/config/src/arguments.rs index b1b8d00..5f51b2b 100644 --- a/crates/config/src/arguments.rs +++ b/crates/config/src/arguments.rs @@ -197,12 +197,12 @@ mod tests { let scratch = Scratch::new("arguments"); let path = |name: &str| scratch.0.join(name).display().to_string(); scratch.file( - "base.toml", - "name = \"base\"\npeers = [\"a\", \"b\"]\nlocal = \"here\"\n", + "base.json", + r#"{"name": "base", "peers": ["a", "b"], "local": "here"}"#, ); scratch.file( "main.json", - r#"{"include": ["base.toml"], "name": "main", "token": {"file": "secret"}}"#, + r#"{"include": ["base.json"], "name": "main", "token": {"file": "secret"}}"#, ); scratch.file("secret", "hush\n"); let layer = merged_of(&["--config", &path("main.json")]).unwrap(); @@ -229,16 +229,16 @@ mod tests { assert!(!layer.contains_key("local")); assert_eq!(layer["remote"].value, json!("there")); // Unknown, and gone. - scratch.file("unknown.toml", "nmae = \"x\"\n"); + scratch.file("unknown.json", r#"{"nmae": "x"}"#); let said = format!( "{:#}", - merged_of(&["--config", &path("unknown.toml")]).unwrap_err() + merged_of(&["--config", &path("unknown.json")]).unwrap_err() ); assert!(said.contains("unknown option"), "{said}"); - scratch.file("gone.toml", "legacy = \"x\"\n"); + scratch.file("gone.json", r#"{"legacy": "x"}"#); let said = format!( "{:#}", - merged_of(&["--config", &path("gone.toml")]).unwrap_err() + merged_of(&["--config", &path("gone.json")]).unwrap_err() ); assert!(said.contains("use name instead"), "{said}"); let said = refuse_gone(["--legacy=x".to_owned()], &SCHEMA).unwrap_err(); |
