1use clap::Parser;2use jrsonnet_evaluator::{error::Result, EvaluationState};34use crate::{ConfigureState, ExtFile, ExtStr};56#[derive(Parser)]7#[clap(next_help_heading = "TOP LEVEL ARGUMENTS")]8pub struct TLAOpts {9 10 11 12 13 #[clap(14 long,15 short = 'A',16 name = "name[=tla data]",17 number_of_values = 1,18 multiple_occurrences = true19 )]20 tla_str: Vec<ExtStr>,21 22 23 #[clap(24 long,25 name = "name=tla path",26 number_of_values = 1,27 multiple_occurrences = true28 )]29 tla_str_file: Vec<ExtFile>,30 31 32 #[clap(33 long,34 name = "name[=tla source]",35 number_of_values = 1,36 multiple_occurrences = true37 )]38 tla_code: Vec<ExtStr>,39 40 41 #[clap(42 long,43 name = "name=tla code path",44 number_of_values = 1,45 multiple_occurrences = true46 )]47 tla_code_file: Vec<ExtFile>,48}49impl ConfigureState for TLAOpts {50 fn configure(&self, state: &EvaluationState) -> Result<()> {51 for tla in self.tla_str.iter() {52 state.add_tla_str((&tla.name as &str).into(), (&tla.value as &str).into());53 }54 for tla in self.tla_str_file.iter() {55 state.add_tla_str((&tla.name as &str).into(), (&tla.value as &str).into())56 }57 for tla in self.tla_code.iter() {58 state.add_tla_code((&tla.name as &str).into(), (&tla.value as &str).into())?;59 }60 for tla in self.tla_code_file.iter() {61 state.add_tla_code((&tla.name as &str).into(), (&tla.value as &str).into())?;62 }63 Ok(())64 }65}