// WARN: This file is auto generated by flood-tide-gen const OPTIONS_TEXT: &str = r"Options: -s, --symbol expected symbol -i, --input bi5 data in -o, --output output to --out-symbol output symbol name --otype output type. (default: xz) --from proces from --to proces to -H, --help display this help and exit -V, --version display version information and exit -X x options. try -X help "; #[repr(u8)] #[derive(Debug, PartialEq, Eq)] enum CmdOp { Symbol, Input, Output, OutSymbol, Otype, From, To, Help, Version, UcX, } impl std::convert::From for CmdOp { fn from(value: u8) -> Self { unsafe { std::mem::transmute(value) } } } impl CmdOp { pub const fn to(self) -> OptNum { self as OptNum } } #[rustfmt::skip] const OPT_ARY: [Opt;10] = [ Opt { sho: b'X', lon: "", has: Arg::Yes, num: CmdOp::UcX.to(), }, Opt { sho: 0u8, lon: "from", has: Arg::Yes, num: CmdOp::From.to(), }, Opt { sho: b'H', lon: "help", has: Arg::No, num: CmdOp::Help.to(), }, Opt { sho: b'i', lon: "input", has: Arg::Yes, num: CmdOp::Input.to(), }, Opt { sho: 0u8, lon: "otype", has: Arg::Yes, num: CmdOp::Otype.to(), }, Opt { sho: 0u8, lon: "out-symbol", has: Arg::Yes, num: CmdOp::OutSymbol.to(), }, Opt { sho: b'o', lon: "output", has: Arg::Yes, num: CmdOp::Output.to(), }, Opt { sho: b's', lon: "symbol", has: Arg::Yes, num: CmdOp::Symbol.to(), }, Opt { sho: 0u8, lon: "to", has: Arg::Yes, num: CmdOp::To.to(), }, Opt { sho: b'V', lon: "version", has: Arg::No, num: CmdOp::Version.to(), }, ]; #[rustfmt::skip] const OPT_ARY_SHO_IDX: [(u8,usize);6] = [ (b'H',2),(b'V',9),(b'X',0),(b'i',3),(b'o',6),(b's',7),]; #[derive(Debug, PartialEq, Eq)] pub struct SubCmdOptConf<'a> { pub parent: &'a CmdOptConf, pub prog_name: String, // pub opt_symbol: String, pub opt_input: String, pub opt_output: String, pub opt_out_symbol: String, pub opt_otype: OptOtypeCompKind, pub opt_from: Option, pub opt_to: Option, pub flg_help: bool, pub flg_version: bool, pub opt_uc_x: Vec, // pub arg_params: Vec, } impl<'a> SubCmdOptConf<'a> { pub fn new(a_parent: &'a CmdOptConf, a_prog_name: String) -> SubCmdOptConf<'a> { SubCmdOptConf { parent: a_parent, prog_name: a_prog_name, // opt_symbol: Default::default(), opt_input: Default::default(), opt_output: Default::default(), opt_out_symbol: Default::default(), opt_otype: Default::default(), opt_from: Default::default(), opt_to: Default::default(), flg_help: Default::default(), flg_version: Default::default(), opt_uc_x: Default::default(), // arg_params: Vec::new(), } } } impl<'a> flood_tide::HelpVersion for SubCmdOptConf<'a> { fn is_help(&self) -> bool { self.flg_help } fn is_version(&self) -> bool { self.flg_version } } fn value_to_string(nv: &NameVal<'_>) -> Result { match nv.val { Some(x) => Ok(x.to_string()), None => Err(OptParseError::missing_option_argument(&nv.opt.lon_or_sho())), } } fn value_to_opt_fromto_date(nv: &NameVal<'_>) -> Result { match nv.val { Some(s) => match FromStr::from_str(s) { Ok(x) => Ok(x), Err(err) => Err(OptParseError::invalid_option_argument( &nv.opt.lon_or_sho(), &err.to_string(), )), }, None => Err(OptParseError::missing_option_argument(&nv.opt.lon_or_sho())), } } fn value_to_opt_otype_comp_kind(nv: &NameVal<'_>) -> Result { match nv.val { Some(s) => match FromStr::from_str(s) { Ok(x) => Ok(x), Err(err) => Err(OptParseError::invalid_option_argument( &nv.opt.lon_or_sho(), &err.to_string(), )), }, None => Err(OptParseError::missing_option_argument(&nv.opt.lon_or_sho())), } } fn value_to_opt_uc_x_param(nv: &NameVal<'_>) -> Result { match nv.val { Some(s) => match FromStr::from_str(s) { Ok(x) => Ok(x), Err(err) => Err(OptParseError::invalid_option_argument( &nv.opt.lon_or_sho(), &err.to_string(), )), }, None => Err(OptParseError::missing_option_argument(&nv.opt.lon_or_sho())), } }