// WARN: This file is auto generated by flood-tide-gen const OPTIONS_TEXT: &str = r"Options: -r, --red write it in red -g, --green write it in green -b, --blue write it in blue -c, --cyan write it in cyan -m, --magenda write it in magenda -y, --yellow write it in yellow -u, --unmark write it in non-color -H, --help display this help and exit -V, --version display version information and exit "; #[repr(u8)] #[derive(Debug, PartialEq, Eq)] enum CmdOp { Red, Green, Blue, Cyan, Magenda, Yellow, Unmark, Help, Version, } 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;9] = [ Opt { sho: b'b', lon: "blue", has: Arg::Yes, num: CmdOp::Blue.to(), }, Opt { sho: b'c', lon: "cyan", has: Arg::Yes, num: CmdOp::Cyan.to(), }, Opt { sho: b'g', lon: "green", has: Arg::Yes, num: CmdOp::Green.to(), }, Opt { sho: b'H', lon: "help", has: Arg::No, num: CmdOp::Help.to(), }, Opt { sho: b'm', lon: "magenda", has: Arg::Yes, num: CmdOp::Magenda.to(), }, Opt { sho: b'r', lon: "red", has: Arg::Yes, num: CmdOp::Red.to(), }, Opt { sho: b'u', lon: "unmark", has: Arg::Yes, num: CmdOp::Unmark.to(), }, Opt { sho: b'V', lon: "version", has: Arg::No, num: CmdOp::Version.to(), }, Opt { sho: b'y', lon: "yellow", has: Arg::Yes, num: CmdOp::Yellow.to(), }, ]; #[rustfmt::skip] const OPT_ARY_SHO_IDX: [(u8,usize);9] = [ (b'H',3),(b'V',7),(b'b',0),(b'c',1),(b'g',2),(b'm',4),(b'r',5),(b'u',6),(b'y',8),]; #[derive(Debug, Default, PartialEq, Eq)] pub struct CmdOptConf { pub prog_name: String, // pub opt_red: String, pub opt_green: String, pub opt_blue: String, pub opt_cyan: String, pub opt_magenda: String, pub opt_yellow: String, pub opt_unmark: String, pub flg_help: bool, pub flg_version: bool, // pub arg_params: Vec, } impl flood_tide::HelpVersion for CmdOptConf { 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())), } }