#[macro_export]
macro_rules! gong_option_set {
( $long:expr, $short:expr, $mode:expr, $abbr:expr ) => {
$crate::options::OptionSetEx {
long: $long, short: $short, mode: $mode, allow_abbreviations: $abbr
}
};
( $long:expr, $short:expr ) => {
$crate::options::OptionSetEx {
long: $long, short: $short, mode: $crate::options::OptionsMode::Standard,
allow_abbreviations: true
}
};
() => { gong_option_set!(vec![], vec![]) };
}
#[macro_export]
macro_rules! gong_option_set_fixed {
( $long:tt, $short:tt, $mode:expr, $abbr:expr ) => {
$crate::options::OptionSet {
long: &$long, short: &$short, mode: $mode, allow_abbreviations: $abbr
}
};
( $long:tt, $short:tt ) => {
$crate::options::OptionSet {
long: &$long, short: &$short, mode: $crate::options::OptionsMode::Standard,
allow_abbreviations: true
}
};
() => { gong_option_set_fixed!([], []) };
}
#[macro_export]
macro_rules! gong_longopt {
( $name:expr, $data:expr ) => {
$crate::options::LongOption { name: $name, expects_data: $data }
};
( $name:expr ) => { $crate::options::LongOption { name: $name, expects_data: false } };
}
#[macro_export]
macro_rules! gong_shortopt {
( $ch:expr, $data:expr ) => { $crate::options::ShortOption { ch: $ch, expects_data: $data } };
( $ch:expr ) => { $crate::options::ShortOption { ch: $ch, expects_data: false } };
}