2022-07-19 18:29:31 +00:00
|
|
|
**This requires enabling the [`derive` feature flag][crate::_features].**
|
2021-12-08 22:46:49 +00:00
|
|
|
|
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-12-15 17:12:16 +00:00
|
|
|
$ git-derive
|
2021-11-30 18:30:19 +00:00
|
|
|
? failed
|
|
|
|
A fictional versioning CLI
|
|
|
|
|
2022-09-07 16:03:55 +00:00
|
|
|
Usage: git-derive[EXE] <COMMAND>
|
2021-11-30 18:30:19 +00:00
|
|
|
|
2022-08-31 02:38:37 +00:00
|
|
|
Commands:
|
2022-09-07 20:29:15 +00:00
|
|
|
clone Clones repos
|
|
|
|
diff Compare two commits
|
|
|
|
push pushes things
|
|
|
|
add adds things
|
|
|
|
stash
|
|
|
|
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:
|
2022-09-07 20:29:15 +00:00
|
|
|
-h, --help Print help information
|
2022-08-26 15:59:27 +00:00
|
|
|
|
2021-12-15 17:12:16 +00:00
|
|
|
$ git-derive help
|
2021-11-30 18:30:19 +00:00
|
|
|
A fictional versioning CLI
|
|
|
|
|
2022-09-07 16:03:55 +00:00
|
|
|
Usage: git-derive[EXE] <COMMAND>
|
2021-11-30 18:30:19 +00:00
|
|
|
|
2022-08-31 02:38:37 +00:00
|
|
|
Commands:
|
2022-09-07 20:29:15 +00:00
|
|
|
clone Clones repos
|
|
|
|
diff Compare two commits
|
|
|
|
push pushes things
|
|
|
|
add adds things
|
|
|
|
stash
|
|
|
|
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:
|
2022-09-07 20:29:15 +00:00
|
|
|
-h, --help Print help information
|
2022-08-26 15:59:27 +00:00
|
|
|
|
2021-12-15 17:12:16 +00:00
|
|
|
$ git-derive help add
|
2021-11-30 18:30:19 +00:00
|
|
|
adds things
|
|
|
|
|
2022-09-07 16:03:55 +00:00
|
|
|
Usage: git-derive[EXE] add <PATH>...
|
2021-11-30 18:30:19 +00:00
|
|
|
|
2022-08-26 14:40:23 +00:00
|
|
|
Arguments:
|
2022-09-07 20:29:15 +00:00
|
|
|
<PATH>... Stuff to add
|
2021-11-30 18:30:19 +00:00
|
|
|
|
2022-08-26 14:40:23 +00:00
|
|
|
Options:
|
2022-09-07 20:29:15 +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-12-15 17:12:16 +00:00
|
|
|
$ git-derive add
|
2021-11-30 18:30:19 +00:00
|
|
|
? failed
|
|
|
|
adds things
|
|
|
|
|
2022-09-07 16:03:55 +00:00
|
|
|
Usage: git-derive[EXE] add <PATH>...
|
2021-11-30 18:30:19 +00:00
|
|
|
|
2022-08-26 14:40:23 +00:00
|
|
|
Arguments:
|
2022-09-07 20:29:15 +00:00
|
|
|
<PATH>... Stuff to add
|
2021-11-30 18:30:19 +00:00
|
|
|
|
2022-08-26 14:40:23 +00:00
|
|
|
Options:
|
2022-09-07 20:29:15 +00:00
|
|
|
-h, --help Print help information
|
2022-01-05 16:54:33 +00:00
|
|
|
|
2021-12-15 17:12:16 +00:00
|
|
|
$ git-derive add Cargo.toml Cargo.lock
|
2021-11-30 18:30:19 +00:00
|
|
|
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-derive stash -h
|
2022-09-07 16:03:55 +00:00
|
|
|
Usage: git-derive[EXE] stash [OPTIONS]
|
|
|
|
git-derive[EXE] stash <COMMAND>
|
2022-03-23 16:08:07 +00:00
|
|
|
|
2022-08-31 02:38:37 +00:00
|
|
|
Commands:
|
2022-09-07 20:29:15 +00:00
|
|
|
push
|
|
|
|
pop
|
|
|
|
apply
|
|
|
|
help Print this message or the help of the given subcommand(s)
|
2022-03-23 16:08:07 +00:00
|
|
|
|
2022-08-26 15:59:27 +00:00
|
|
|
Options:
|
2022-09-07 20:29:15 +00:00
|
|
|
-m, --message <MESSAGE>
|
|
|
|
-h, --help Print help information
|
2022-08-26 15:59:27 +00:00
|
|
|
|
2022-03-23 16:08:07 +00:00
|
|
|
$ git-derive stash push -h
|
2022-09-07 16:03:55 +00:00
|
|
|
Usage: git-derive[EXE] stash push [OPTIONS]
|
2022-03-23 16:08:07 +00:00
|
|
|
|
2022-08-26 14:40:23 +00:00
|
|
|
Options:
|
2022-09-07 20:29:15 +00:00
|
|
|
-m, --message <MESSAGE>
|
|
|
|
-h, --help Print help information
|
2022-03-23 16:08:07 +00:00
|
|
|
|
|
|
|
$ git-derive stash pop -h
|
2022-09-07 16:03:55 +00:00
|
|
|
Usage: git-derive[EXE] stash pop [STASH]
|
2022-03-23 16:08:07 +00:00
|
|
|
|
2022-08-26 14:40:23 +00:00
|
|
|
Arguments:
|
2022-09-07 20:29:15 +00:00
|
|
|
[STASH]
|
2022-03-23 16:08:07 +00:00
|
|
|
|
2022-08-26 14:40:23 +00:00
|
|
|
Options:
|
2022-09-07 20:29:15 +00:00
|
|
|
-h, --help Print help information
|
2022-03-23 16:08:07 +00:00
|
|
|
|
|
|
|
$ 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 18:30:19 +00:00
|
|
|
External subcommands:
|
2022-01-05 16:54:33 +00:00
|
|
|
```console
|
2021-12-15 17:12:16 +00:00
|
|
|
$ git-derive custom-tool arg1 --foo bar
|
2021-11-30 18:30:19 +00:00
|
|
|
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
|
|
|
```
|
2022-09-07 16:19:28 +00:00
|
|
|
|
|
|
|
Last argument:
|
|
|
|
```console
|
|
|
|
$ git-derive diff --help
|
|
|
|
Compare two commits
|
|
|
|
|
2022-10-01 01:33:36 +00:00
|
|
|
Usage: git-derive[EXE] diff [OPTIONS] [COMMIT] [COMMIT] [-- <PATH>]
|
2022-09-07 16:19:28 +00:00
|
|
|
|
|
|
|
Arguments:
|
2022-09-07 20:29:15 +00:00
|
|
|
[COMMIT]
|
|
|
|
[COMMIT]
|
|
|
|
[PATH]
|
2022-09-07 16:19:28 +00:00
|
|
|
|
|
|
|
Options:
|
2022-10-01 01:33:36 +00:00
|
|
|
--color[=<WHEN>] [default: auto] [possible values: always, auto, never]
|
|
|
|
-h, --help Print help information
|
2022-09-07 16:19:28 +00:00
|
|
|
|
|
|
|
$ git-derive diff
|
2022-10-01 01:33:36 +00:00
|
|
|
Diffing stage..worktree (color=auto)
|
2022-09-07 16:19:28 +00:00
|
|
|
|
|
|
|
$ git-derive diff ./src
|
2022-10-01 01:33:36 +00:00
|
|
|
Diffing stage..worktree ./src (color=auto)
|
2022-09-07 16:19:28 +00:00
|
|
|
|
|
|
|
$ git-derive diff HEAD ./src
|
2022-10-01 01:33:36 +00:00
|
|
|
Diffing HEAD..worktree ./src (color=auto)
|
2022-09-07 16:19:28 +00:00
|
|
|
|
|
|
|
$ git-derive diff HEAD~~ -- HEAD
|
2022-10-01 01:33:36 +00:00
|
|
|
Diffing HEAD~~..worktree HEAD (color=auto)
|
|
|
|
|
|
|
|
$ git-derive diff --color
|
|
|
|
Diffing stage..worktree (color=always)
|
|
|
|
|
|
|
|
$ git-derive diff --color=never
|
|
|
|
Diffing stage..worktree (color=never)
|
2022-09-07 16:19:28 +00:00
|
|
|
|
|
|
|
```
|