argparse/
lib.rs

1#![crate_name = "argparse"]
2#![crate_type = "lib"]
3
4pub use self::parser::{ArgumentParser, Ref};
5
6pub mod action;
7pub mod parser;
8mod generic;
9mod custom;
10mod help;
11mod print;
12
13mod bool;
14mod num;
15mod from_cli;
16
17pub trait FromCommandLine: Sized {
18    fn from_argument(s: &str) -> Result<Self, String>;
19}
20
21// TODO(tailhook) make consts
22pub struct StoreTrue;
23pub struct StoreFalse;
24
25pub struct StoreConst<T>(pub T);
26
27pub struct PushConst<T>(pub T);
28
29pub struct Store;
30pub struct Parse;
31
32pub struct StoreOption;
33pub struct ParseOption;
34
35pub struct List;
36pub struct ParseList;
37
38pub struct Collect;
39pub struct ParseCollect;
40
41/// Print string and exit with status 0
42///
43/// Particularly useful for `--version` option and similar
44pub struct Print(pub String);
45
46pub struct IncrBy<T>(pub T);
47
48pub struct DecrBy<T>(pub T);
49
50
51#[cfg(test)] mod test_parser;
52#[cfg(test)] mod test_bool;
53#[cfg(test)] mod test_int;
54#[cfg(test)] mod test_float;
55#[cfg(test)] mod test_str;
56#[cfg(test)] mod test_enum;
57#[cfg(test)] mod test_pos;
58#[cfg(test)] mod test_many;
59#[cfg(test)] mod test_optional;
60#[cfg(test)] mod test_usage;
61#[cfg(test)] mod test_help;
62#[cfg(test)] mod test_env;
63#[cfg(test)] mod test_const;
64#[cfg(test)] mod test_path;