// WARN: This file is auto generated by flood-tide-gen const OPTIONS_TEXT: &str = r"Options: -v, --verbose verbose message -q, --quiet quiet message -d, --debug debug message -n, --dry-run not realy prosess -e, --exclude regex string of exclude file name -s, --limit-size file size limit -h, --help display this help and exit -V, --version output version information and exit "; #[repr(u8)] #[derive(Debug, PartialEq, Eq)] enum CmdOp { Verbose, Quiet, Debug, DryRun, Exclude, LimitSize, 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;8] = [ Opt { sho: b'd', lon: "debug", has: Arg::No, num: CmdOp::Debug.to(), }, Opt { sho: b'n', lon: "dry-run", has: Arg::No, num: CmdOp::DryRun.to(), }, Opt { sho: b'e', lon: "exclude", has: Arg::Yes, num: CmdOp::Exclude.to(), }, Opt { sho: b'h', lon: "help", has: Arg::No, num: CmdOp::Help.to(), }, Opt { sho: b's', lon: "limit-size", has: Arg::Yes, num: CmdOp::LimitSize.to(), }, Opt { sho: b'q', lon: "quiet", has: Arg::No, num: CmdOp::Quiet.to(), }, Opt { sho: b'v', lon: "verbose", has: Arg::No, num: CmdOp::Verbose.to(), }, Opt { sho: b'V', lon: "version", has: Arg::No, num: CmdOp::Version.to(), }, ]; #[rustfmt::skip] const OPT_ARY_SHO_IDX: [(u8,usize);8] = [ (b'V',7),(b'd',0),(b'e',2),(b'h',3),(b'n',1),(b'q',5),(b's',4),(b'v',6),]; #[derive(Debug, Default, PartialEq, Eq)] pub struct CmdOptConf { pub prog_name: String, // pub flg_verbose: bool, pub flg_quiet: bool, pub flg_debug: bool, pub flg_dry_run: bool, pub opt_exclude: String, pub opt_limit_size: 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())), } }