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
//! Argument parsing and declaration using just the help text.
//!
//! Since the help text is describing how a program can be run why not use that fact to have a
//! zero-copy argument parsing solution? All one needs to do is write the help text and then send
//! in the stream of arguments to the program to be auto-magically handled.
//!
//! # Advantages
//! * No need to write your own parser.
//! * The help text's format is up to the implementor as long they follow convention.
//!
//! # Disadvantages
//! * No compile-time checking of the help text. Could lead to sneaky typos and other issues
//! propping up. This could be alleviated by a proc-macro which does all the checks.
//! * No type inferance/conversion. Since, all arguments are `&str` (or rather `[u8]`) there is no need
//! to introduce extra complexity by allowing for conversion of arguments to a given type when that
//! can be done by the user after parsing.
//!
//! Notable other implementations:
//! * `docopt` - 'official' docopt implementation done by burntsushi. Is abandoned, uses too many
//! dependencies, doesn't take advantage of the fact that reallocations are unnecessary, parsing is
//! dubiously implemented.
//! * `lapp` - is not as complete as `docopt`
//!
//! ## Features
//! * `std` - enabled XDG-compliance helper traits for structs that use serde
extern crate alloc;
pub use *;
pub use Result;