// WARN: This file is auto generated by flood-tide-gen const OPTIONS_TEXT: &str = r"Options: -f, --function print function size -d, --demangle demangle function name -a, --append-file-name append file name to function -s, --separator output field separator -H, --help display this help and exit -V, --version output version information and exit "; #[repr(u8)] #[derive(Debug, PartialEq, Eq)] enum CmdOp { Function, Demangle, AppendFileName, Separator, 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;6] = [ Opt { sho: b'a', lon: "append-file-name",has: Arg::No, num: CmdOp::AppendFileName.to(), }, Opt { sho: b'd', lon: "demangle", has: Arg::No, num: CmdOp::Demangle.to(), }, Opt { sho: b'f', lon: "function", has: Arg::No, num: CmdOp::Function.to(), }, Opt { sho: b'H', lon: "help", has: Arg::No, num: CmdOp::Help.to(), }, Opt { sho: b's', lon: "separator", has: Arg::Yes, num: CmdOp::Separator.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',3),(b'V',5),(b'a',0),(b'd',1),(b'f',2),(b's',4),]; #[derive(Debug, Default, PartialEq, Eq)] pub struct CmdOptConf { pub prog_name: String, // pub flg_function: bool, pub flg_demangle: bool, pub flg_append_file_name: bool, pub opt_separator: 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())), } }