difftreelog
docs Fix docs of tla.rs
in: master
1 file changed
crates/jrsonnet-cli/src/tla.rsdiffbeforeafterboth1use crate::{ConfigureState, 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 /// prefer using them instead of ExtVars.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<ExtStr>,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}23impl ConfigureState for TLAOpts {24 fn configure(&self, state: &EvaluationState) -> Result<()> {25 for tla in self.tla_str.iter() {26 state.add_tla_str((&tla.name as &str).into(), (&tla.value as &str).into());27 }28 for tla in self.tla_code.iter() {29 state.add_tla_code((&tla.name as &str).into(), (&tla.value as &str).into())?;30 }31 Ok(())32 }33}1use crate::{ConfigureState, 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<ExtStr>,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}23impl ConfigureState for TLAOpts {24 fn configure(&self, state: &EvaluationState) -> Result<()> {25 for tla in self.tla_str.iter() {26 state.add_tla_str((&tla.name as &str).into(), (&tla.value as &str).into());27 }28 for tla in self.tla_code.iter() {29 state.add_tla_code((&tla.name as &str).into(), (&tla.value as &str).into())?;30 }31 Ok(())32 }33}