#[derive(Clone, Copy, Debug)]
pub struct Env {
pub name: &'static str,
pub aliases: &'static [&'static str],
}
impl Env {
pub const EMPTY: Env = Env {
name: "",
aliases: &[],
};
pub const fn new(name: &'static str) -> Env {
Env { name, aliases: &[] }
}
}
#[derive(Clone, Copy, Debug)]
pub struct Arg {
pub long: Option<&'static str>,
pub short: Option<char>,
pub negatable: bool,
pub repeatable: bool,
pub value_name: &'static str,
}
impl Arg {
pub const EMPTY: Arg = Arg {
long: None,
short: None,
negatable: false,
repeatable: false,
value_name: "",
};
pub const fn long(long: &'static str) -> Arg {
Arg {
long: Some(long),
..Arg::EMPTY
}
}
pub const fn short(short: char) -> Arg {
Arg {
short: Some(short),
..Arg::EMPTY
}
}
pub const fn pair(long: &'static str, short: char) -> Arg {
Arg {
long: Some(long),
short: Some(short),
..Arg::EMPTY
}
}
}