1use clap::Parser;2use jrsonnet_evaluator::{error::Result, State};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(long, short = 'A', name = "name[=tla data]", number_of_values = 1)]14 tla_str: Vec<ExtStr>,15 16 17 #[clap(long, name = "name=tla path", number_of_values = 1)]18 tla_str_file: Vec<ExtFile>,19 20 21 #[clap(long, name = "name[=tla source]", number_of_values = 1)]22 tla_code: Vec<ExtStr>,23 24 25 #[clap(long, name = "name=tla code path", number_of_values = 1)]26 tla_code_file: Vec<ExtFile>,27}28impl ConfigureState for TLAOpts {29 type Guards = ();30 fn configure(&self, s: &State) -> Result<()> {31 for tla in self.tla_str.iter() {32 s.add_tla_str((&tla.name as &str).into(), (&tla.value as &str).into());33 }34 for tla in self.tla_str_file.iter() {35 s.add_tla_str((&tla.name as &str).into(), (&tla.value as &str).into())36 }37 for tla in self.tla_code.iter() {38 s.add_tla_code((&tla.name as &str).into(), &tla.value as &str)?;39 }40 for tla in self.tla_code_file.iter() {41 s.add_tla_code((&tla.name as &str).into(), &tla.value as &str)?;42 }43 Ok(())44 }45}