difftreelog
fix clap now requires multiple_occurrences
in: master
2 files changed
crates/jrsonnet-cli/src/ext.rsdiffbeforeafterboth--- a/crates/jrsonnet-cli/src/ext.rs
+++ b/crates/jrsonnet-cli/src/ext.rs
@@ -61,19 +61,40 @@
/// to use top level arguments whenever it's possible.
/// If [=data] is not set then it will be read from `name` env variable.
/// Can be accessed from code via `std.extVar("name")`.
- #[clap(long, short = 'V', name = "name[=var data]", number_of_values = 1)]
+ #[clap(
+ long,
+ short = 'V',
+ name = "name[=var data]",
+ number_of_values = 1,
+ multiple_occurrences = true
+ )]
ext_str: Vec<ExtStr>,
/// Read string external variable from file.
/// See also `--ext-str`
- #[clap(long, name = "name=var path", number_of_values = 1)]
+ #[clap(
+ long,
+ name = "name=var path",
+ number_of_values = 1,
+ multiple_occurrences = true
+ )]
ext_str_file: Vec<ExtFile>,
/// Add external variable from code.
/// See also `--ext-str`
- #[clap(long, name = "name[=var source]", number_of_values = 1)]
+ #[clap(
+ long,
+ name = "name[=var source]",
+ number_of_values = 1,
+ multiple_occurrences = true
+ )]
ext_code: Vec<ExtStr>,
/// Read string external variable from file.
/// See also `--ext-str`
- #[clap(long, name = "name=var code path", number_of_values = 1)]
+ #[clap(
+ long,
+ name = "name=var code path",
+ number_of_values = 1,
+ multiple_occurrences = true
+ )]
ext_code_file: Vec<ExtFile>,
}
impl ConfigureState for ExtVarOpts {
crates/jrsonnet-cli/src/tla.rsdiffbeforeafterboth1use crate::{ConfigureState, ExtFile, ExtStr};2use clap::Clap;3use jrsonnet_evaluator::{error::Result, EvaluationState};45#[derive(Clap)]6#[clap(help_heading = "TOP LEVEL ARGUMENTS")]7pub struct TLAOpts {8 /// Add top level string argument.9 /// Top level arguments will be passed to function before manifestification stage.10 /// This is preferred to ExtVars method.11 /// If [=data] is not set then it will be read from `name` env variable.12 #[clap(long, short = 'A', name = "name[=tla data]", number_of_values = 1)]13 tla_str: Vec<ExtStr>,14 /// Read top level argument string from file.15 /// See also `--tla-str`16 #[clap(long, name = "name=tla path", number_of_values = 1)]17 tla_str_file: Vec<ExtFile>,18 /// Add top level argument from code.19 /// See also `--tla-str`20 #[clap(long, name = "name[=tla source]", number_of_values = 1)]21 tla_code: Vec<ExtStr>,22 /// Read top level argument code from file.23 /// See also `--tla-str`24 #[clap(long, name = "name=tla code path", number_of_values = 1)]25 tla_code_file: Vec<ExtFile>,26}27impl ConfigureState for TLAOpts {28 fn configure(&self, state: &EvaluationState) -> Result<()> {29 for tla in self.tla_str.iter() {30 state.add_tla_str((&tla.name as &str).into(), (&tla.value as &str).into());31 }32 for tla in self.tla_str_file.iter() {33 state.add_tla_str((&tla.name as &str).into(), (&tla.value as &str).into())34 }35 for tla in self.tla_code.iter() {36 state.add_tla_code((&tla.name as &str).into(), (&tla.value as &str).into())?;37 }38 for tla in self.tla_code_file.iter() {39 state.add_tla_code((&tla.name as &str).into(), (&tla.value as &str).into())?;40 }41 Ok(())42 }43}1use crate::{ConfigureState, ExtFile, ExtStr};2use clap::Clap;3use jrsonnet_evaluator::{error::Result, EvaluationState};45#[derive(Clap)]6#[clap(help_heading = "TOP LEVEL ARGUMENTS")]7pub struct TLAOpts {8 /// Add top level string argument.9 /// Top level arguments will be passed to function before manifestification stage.10 /// This is preferred to ExtVars method.11 /// If [=data] is not set then it will be read from `name` env variable.12 #[clap(13 long,14 short = 'A',15 name = "name[=tla data]",16 number_of_values = 1,17 multiple_occurrences = true18 )]19 tla_str: Vec<ExtStr>,20 /// Read top level argument string from file.21 /// See also `--tla-str`22 #[clap(23 long,24 name = "name=tla path",25 number_of_values = 1,26 multiple_occurrences = true27 )]28 tla_str_file: Vec<ExtFile>,29 /// Add top level argument from code.30 /// See also `--tla-str`31 #[clap(32 long,33 name = "name[=tla source]",34 number_of_values = 1,35 multiple_occurrences = true36 )]37 tla_code: Vec<ExtStr>,38 /// Read top level argument code from file.39 /// See also `--tla-str`40 #[clap(41 long,42 name = "name=tla code path",43 number_of_values = 1,44 multiple_occurrences = true45 )]46 tla_code_file: Vec<ExtFile>,47}48impl ConfigureState for TLAOpts {49 fn configure(&self, state: &EvaluationState) -> Result<()> {50 for tla in self.tla_str.iter() {51 state.add_tla_str((&tla.name as &str).into(), (&tla.value as &str).into());52 }53 for tla in self.tla_str_file.iter() {54 state.add_tla_str((&tla.name as &str).into(), (&tla.value as &str).into())55 }56 for tla in self.tla_code.iter() {57 state.add_tla_code((&tla.name as &str).into(), (&tla.value as &str).into())?;58 }59 for tla in self.tla_code_file.iter() {60 state.add_tla_code((&tla.name as &str).into(), (&tla.value as &str).into())?;61 }62 Ok(())63 }64}