aboutsummaryrefslogtreecommitdiff
path: root/argparse/src/lib.rs
blob: 62b0cf95ec1f8116483ee49ff2a010ce863a7289 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#![crate_name = "argparse"]
#![crate_type = "lib"]

pub use self::parser::{ArgumentParser, Ref};

pub mod action;
pub mod parser;
mod generic;
mod custom;
mod help;
mod print;

mod bool;
mod num;
mod from_cli;

pub trait FromCommandLine: Sized {
    fn from_argument(s: &str) -> Result<Self, String>;
}

// TODO(tailhook) make consts
pub struct StoreTrue;
pub struct StoreFalse;

pub struct StoreConst<T>(pub T);

pub struct PushConst<T>(pub T);

pub struct Store;
pub struct Parse;

pub struct StoreOption;
pub struct ParseOption;

pub struct List;
pub struct ParseList;

pub struct Collect;
pub struct ParseCollect;

/// Print string and exit with status 0
///
/// Particularly useful for `--version` option and similar
pub struct Print(pub String);

pub struct IncrBy<T>(pub T);

pub struct DecrBy<T>(pub T);


#[cfg(test)] mod test_parser;
#[cfg(test)] mod test_bool;
#[cfg(test)] mod test_int;
#[cfg(test)] mod test_float;
#[cfg(test)] mod test_str;
#[cfg(test)] mod test_enum;
#[cfg(test)] mod test_pos;
#[cfg(test)] mod test_many;
#[cfg(test)] mod test_optional;
#[cfg(test)] mod test_usage;
#[cfg(test)] mod test_help;
#[cfg(test)] mod test_env;
#[cfg(test)] mod test_const;
#[cfg(test)] mod test_path;