Skip to content

Commit

Permalink
upd yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
bartvanbenthem committed Jul 4, 2023
1 parent de3cd3e commit f81a591
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ struct Config {
template_file: String,
output_file: String,
json_file: String,
yaml_file: String,
}

fn main() -> Result<(), Box<dyn Error>> {
Expand Down Expand Up @@ -78,18 +79,27 @@ fn get_args() -> Result<Config, Box<dyn Error>> {
)
.arg(
Arg::with_name("variables_json")
.short("v")
.long("variables")
.short("j")
.long("variables-json")
.required(false)
.takes_value(true)
.help("Path to the JSON file"),
)
.arg(
Arg::with_name("variables_yaml")
.short("y")
.long("variables-yaml")
.required(false)
.takes_value(true)
.help("Path to the YAML file"),
)
.get_matches();

Ok(Config {
template_file: matches.value_of("template_file").unwrap().to_string(),
output_file: matches.value_of("output_file").unwrap_or("").to_string(),
json_file: matches.value_of("variables_json").unwrap_or("").to_string(),
yaml_file: matches.value_of("variables_yaml").unwrap_or("").to_string(),
})
}

Expand Down

0 comments on commit f81a591

Please sign in to comment.