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 9 10 11 12 #[clap(long, short = 'A', name = "name[=tla data]", number_of_values = 1)]13 tla_str: Vec<ExtStr>,14 15 16 #[clap(long, name = "name=tla path", number_of_values = 1)]17 tla_str_file: Vec<ExtFile>,18 19 20 #[clap(long, name = "name[=tla source]", number_of_values = 1)]21 tla_code: Vec<ExtStr>,22 23 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}