Default value on the command line
- In this example we set the
config_filevariable to the parameter passed on the command line - or to a default value that can be any string, including the empty string.
fn main() {
let argv: Vec<String> = std::env::args().collect();
let config_file = if argv.len() == 2 {
&argv[1]
} else {
//""
"config.yaml"
};
println!("'{}'", config_file);
}