aboutsummaryrefslogtreecommitdiff
path: root/structopt/examples/README.md
blob: f0db20b6f38dd591b10e16e5346916ee3a5d9f7d (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Collection of examples "how to use `structopt`"

### [Help on the bottom](after_help.rs)

How to append a postscript to the help message generated.

### [At least N](at_least_two.rs)

How to require presence of at least N values, like `val1 val2 ... valN ... valM`.

### [Basic](basic.rs)

A basic example how to use `structopt`.

### [Deny missing docs](deny_missing_docs.rs)

**This is not an example but a test**, it should be moved to `tests` folder
as soon as [this](https://github.com/rust-lang/rust/issues/24584) is fixed (if ever).

### [Doc comments](doc_comments.rs)

How to use doc comments in place of `help/long_help`.

### [Enums as arguments](enum_in_args.rs)

How to use `arg_enum!` with `StructOpt`.

### [Arguments of subcommands in separate `struct`](enum_tuple.rs)

How to extract subcommands' args into external structs.

### [Environment variables](env.rs)

How to use environment variable fallback an how it interacts with `default_value`.

### [Advanced](example.rs)

Somewhat complex example of usage of `structopt`.

### [Flatten](flatten.rs)

How to use `#[structopt(flatten)]`

### [`bash` completions](gen_completions.rs)

Generating `bash` completions with `structopt`.

### [Git](git.rs)

Pseudo-`git` example, shows how to use subcommands and how to document them.

### [Groups](group.rs)

Using `clap::Arg::group` with `structopt`.

### [`key=value` pairs](keyvalue.rs)

How to parse `key=value` pairs.

### [`--no-*` flags](negative_flag.rs)

How to add `no-thing` flag which is `true` by default and `false` if passed.

### [No version](no_version.rs)

How to completely remove version.

### [Rename all](rename_all.rs)

How `#[structopt(rename_all)]` works.

### [Skip](skip.rs)

How to use `#[structopt(skip)]`.

### [Aliases](subcommand_aliases.rs)

How to use aliases

### [`true` or `false`](true_or_false.rs)

How to express "`"true"` or `"false"` argument.