diff --git a/src/main.rs b/src/main.rs index 9e2dc8d..18eac6a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -32,8 +32,7 @@ fn main() -> Result<()> { .with_context(|| format!("`{input}` does not contain valid JSON"))?; let mut vars: Vec = vec![]; - let separator = args.separator.unwrap_or("__".to_string()); - JsonParser::parse(&mut vars, "", &json, &separator); + JsonParser::parse(&mut vars, "", &json, &args.separator); let environ = vars .iter() @@ -70,9 +69,9 @@ struct Args { #[arg(short, long, value_name = "FILE")] output: Option, - /// Separator for nested keys, defaults to double underscore (__) - #[arg(short, long, value_name = "STRING")] - separator: Option, + /// Separator for nested keys + #[arg(short, long, value_name = "STRING", default_value = "__")] + separator: String, } struct JsonParser;