2021-11-30 18:30:19 +00:00
|
|
|
Git is an example of several common subcommand patterns.
|
|
|
|
|
|
|
|
Help:
|
2022-01-05 16:54:33 +00:00
|
|
|
```console
|
2021-11-30 18:30:19 +00:00
|
|
|
$ git
|
|
|
|
? failed
|
|
|
|
A fictional versioning CLI
|
|
|
|
|
2022-08-26 14:40:23 +00:00
|
|
|
Usage:
|
2022-08-31 02:38:37 +00:00
|
|
|
git[EXE] <COMMAND>
|
2021-11-30 18:30:19 +00:00
|
|
|
|
2022-08-31 02:38:37 +00:00
|
|
|
Commands:
|
2021-11-30 18:30:19 +00:00
|
|
|
clone Clones repos
|
|
|
|
push pushes things
|
2022-07-22 19:58:27 +00:00
|
|
|
add adds things
|
2022-03-23 16:08:07 +00:00
|
|
|
stash
|
2022-07-22 19:58:27 +00:00
|
|
|
help Print this message or the help of the given subcommand(s)
|
2022-01-05 16:54:33 +00:00
|
|
|
|
2022-08-26 15:59:27 +00:00
|
|
|
Options:
|
|
|
|
-h, --help Print help information
|
|
|
|
|
2021-11-30 18:30:19 +00:00
|
|
|
$ git help
|
|
|
|
A fictional versioning CLI
|
|
|
|
|
2022-08-26 14:40:23 +00:00
|
|
|
Usage:
|
2022-08-31 02:38:37 +00:00
|
|
|
git[EXE] <COMMAND>
|
2021-11-30 18:30:19 +00:00
|
|
|
|
2022-08-31 02:38:37 +00:00
|
|
|
Commands:
|
2021-11-30 18:30:19 +00:00
|
|
|
clone Clones repos
|
|
|
|
push pushes things
|
2022-07-22 19:58:27 +00:00
|
|
|
add adds things
|
2022-03-23 16:08:07 +00:00
|
|
|
stash
|
2022-07-22 19:58:27 +00:00
|
|
|
help Print this message or the help of the given subcommand(s)
|
2022-01-05 16:54:33 +00:00
|
|
|
|
2022-08-26 15:59:27 +00:00
|
|
|
Options:
|
|
|
|
-h, --help Print help information
|
|
|
|
|
2021-11-30 18:30:19 +00:00
|
|
|
$ git help add
|
|
|
|
adds things
|
|
|
|
|
2022-08-26 14:40:23 +00:00
|
|
|
Usage:
|
2021-11-30 18:30:19 +00:00
|
|
|
git[EXE] add <PATH>...
|
|
|
|
|
2022-08-26 14:40:23 +00:00
|
|
|
Arguments:
|
2021-11-30 18:30:19 +00:00
|
|
|
<PATH>... Stuff to add
|
|
|
|
|
2022-08-26 14:40:23 +00:00
|
|
|
Options:
|
2021-11-30 18:30:19 +00:00
|
|
|
-h, --help Print help information
|
2022-01-05 16:54:33 +00:00
|
|
|
|
2021-11-30 18:30:19 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
A basic argument:
|
2022-01-05 16:54:33 +00:00
|
|
|
```console
|
2021-11-30 18:30:19 +00:00
|
|
|
$ git add
|
|
|
|
? failed
|
|
|
|
adds things
|
|
|
|
|
2022-08-26 14:40:23 +00:00
|
|
|
Usage:
|
2021-11-30 18:30:19 +00:00
|
|
|
git[EXE] add <PATH>...
|
|
|
|
|
2022-08-26 14:40:23 +00:00
|
|
|
Arguments:
|
2021-11-30 18:30:19 +00:00
|
|
|
<PATH>... Stuff to add
|
|
|
|
|
2022-08-26 14:40:23 +00:00
|
|
|
Options:
|
2021-11-30 18:30:19 +00:00
|
|
|
-h, --help Print help information
|
2022-01-05 16:54:33 +00:00
|
|
|
|
2021-11-30 18:30:19 +00:00
|
|
|
$ git add Cargo.toml Cargo.lock
|
|
|
|
Adding ["Cargo.toml", "Cargo.lock"]
|
2022-01-05 16:54:33 +00:00
|
|
|
|
2021-11-30 18:30:19 +00:00
|
|
|
```
|
|
|
|
|
2022-03-23 16:08:07 +00:00
|
|
|
Default subcommand:
|
|
|
|
```console
|
|
|
|
$ git stash -h
|
2022-08-26 14:40:23 +00:00
|
|
|
Usage:
|
2022-03-25 12:20:46 +00:00
|
|
|
git[EXE] stash [OPTIONS]
|
2022-08-31 02:38:37 +00:00
|
|
|
git[EXE] stash <COMMAND>
|
2022-03-23 16:08:07 +00:00
|
|
|
|
2022-08-31 02:38:37 +00:00
|
|
|
Commands:
|
2022-07-22 19:58:27 +00:00
|
|
|
push
|
|
|
|
pop
|
2022-03-23 16:08:07 +00:00
|
|
|
apply
|
|
|
|
help Print this message or the help of the given subcommand(s)
|
|
|
|
|
2022-08-26 15:59:27 +00:00
|
|
|
Options:
|
|
|
|
-m, --message <MESSAGE>
|
|
|
|
-h, --help Print help information
|
|
|
|
|
2022-03-23 16:08:07 +00:00
|
|
|
$ git stash push -h
|
2022-08-26 14:40:23 +00:00
|
|
|
Usage:
|
2022-03-25 12:20:46 +00:00
|
|
|
git[EXE] stash push [OPTIONS]
|
2022-03-23 16:08:07 +00:00
|
|
|
|
2022-08-26 14:40:23 +00:00
|
|
|
Options:
|
2022-03-23 16:08:07 +00:00
|
|
|
-m, --message <MESSAGE>
|
2022-07-22 20:43:49 +00:00
|
|
|
-h, --help Print help information
|
2022-03-23 16:08:07 +00:00
|
|
|
|
|
|
|
$ git stash pop -h
|
2022-08-26 14:40:23 +00:00
|
|
|
Usage:
|
2022-03-25 12:20:46 +00:00
|
|
|
git[EXE] stash pop [STASH]
|
2022-03-23 16:08:07 +00:00
|
|
|
|
2022-08-26 14:40:23 +00:00
|
|
|
Arguments:
|
2022-08-29 20:09:06 +00:00
|
|
|
[STASH]
|
2022-03-23 16:08:07 +00:00
|
|
|
|
2022-08-26 14:40:23 +00:00
|
|
|
Options:
|
2022-03-23 16:08:07 +00:00
|
|
|
-h, --help Print help information
|
|
|
|
|
|
|
|
$ git stash -m "Prototype"
|
|
|
|
Pushing Some("Prototype")
|
|
|
|
|
|
|
|
$ git stash pop
|
|
|
|
Popping None
|
|
|
|
|
|
|
|
$ git stash push -m "Prototype"
|
|
|
|
Pushing Some("Prototype")
|
|
|
|
|
|
|
|
$ git stash pop
|
|
|
|
Popping None
|
|
|
|
|
|
|
|
```
|
|
|
|
|
2021-11-30 18:30:19 +00:00
|
|
|
External subcommands:
|
2022-01-05 16:54:33 +00:00
|
|
|
```console
|
2021-11-30 18:30:19 +00:00
|
|
|
$ git custom-tool arg1 --foo bar
|
|
|
|
Calling out to "custom-tool" with ["arg1", "--foo", "bar"]
|
2022-01-05 16:54:33 +00:00
|
|
|
|
2021-11-30 18:30:19 +00:00
|
|
|
```
|