]> git.proxmox.com Git - cargo.git/blame - vendor/clap/examples/git.md
Merge branch 'debian/sid' into proxmox/bullseye
[cargo.git] / vendor / clap / examples / git.md
CommitLineData
62c5094d
FG
1Git is an example of several common subcommand patterns.
2
3Help:
4```console
5$ git
6? failed
7git
8A fictional versioning CLI
9
10USAGE:
11 git[EXE] <SUBCOMMAND>
12
13OPTIONS:
14 -h, --help Print help information
15
16SUBCOMMANDS:
17 add adds things
18 clone Clones repos
19 help Print this message or the help of the given subcommand(s)
20 push pushes things
21 stash
22
23$ git help
24git
25A fictional versioning CLI
26
27USAGE:
28 git[EXE] <SUBCOMMAND>
29
30OPTIONS:
31 -h, --help Print help information
32
33SUBCOMMANDS:
34 add adds things
35 clone Clones repos
36 help Print this message or the help of the given subcommand(s)
37 push pushes things
38 stash
39
40$ git help add
41git[EXE]-add
42adds things
43
44USAGE:
45 git[EXE] add <PATH>...
46
47ARGS:
48 <PATH>... Stuff to add
49
50OPTIONS:
51 -h, --help Print help information
52
53```
54
55A basic argument:
56```console
57$ git add
58? failed
59git[EXE]-add
60adds things
61
62USAGE:
63 git[EXE] add <PATH>...
64
65ARGS:
66 <PATH>... Stuff to add
67
68OPTIONS:
69 -h, --help Print help information
70
71$ git add Cargo.toml Cargo.lock
72Adding ["Cargo.toml", "Cargo.lock"]
73
74```
75
76Default subcommand:
77```console
78$ git stash -h
79git[EXE]-stash
80
81USAGE:
82 git[EXE] stash [OPTIONS]
83 git[EXE] stash <SUBCOMMAND>
84
85OPTIONS:
86 -h, --help Print help information
87 -m, --message <MESSAGE>
88
89SUBCOMMANDS:
90 apply
91 help Print this message or the help of the given subcommand(s)
92 pop
93 push
94
95$ git stash push -h
96git[EXE]-stash-push
97
98USAGE:
99 git[EXE] stash push [OPTIONS]
100
101OPTIONS:
102 -h, --help Print help information
103 -m, --message <MESSAGE>
104
105$ git stash pop -h
106git[EXE]-stash-pop
107
108USAGE:
109 git[EXE] stash pop [STASH]
110
111ARGS:
112 <STASH>
113
114OPTIONS:
115 -h, --help Print help information
116
117$ git stash -m "Prototype"
118Pushing Some("Prototype")
119
120$ git stash pop
121Popping None
122
123$ git stash push -m "Prototype"
124Pushing Some("Prototype")
125
126$ git stash pop
127Popping None
128
129```
130
131External subcommands:
132```console
133$ git custom-tool arg1 --foo bar
134Calling out to "custom-tool" with ["arg1", "--foo", "bar"]
135
136```