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