1**This requires enabling the [`derive` feature flag][crate::_features].** 2 3Git is an example of several common subcommand patterns. 4 5Help: 6```console 7$ git-derive 8? failed 9A fictional versioning CLI 10 11Usage: git-derive[EXE] <COMMAND> 12 13Commands: 14 clone Clones repos 15 diff Compare two commits 16 push pushes things 17 add adds things 18 stash 19 help Print this message or the help of the given subcommand(s) 20 21Options: 22 -h, --help Print help 23 24$ git-derive help 25A fictional versioning CLI 26 27Usage: git-derive[EXE] <COMMAND> 28 29Commands: 30 clone Clones repos 31 diff Compare two commits 32 push pushes things 33 add adds things 34 stash 35 help Print this message or the help of the given subcommand(s) 36 37Options: 38 -h, --help Print help 39 40$ git-derive help add 41adds things 42 43Usage: git-derive[EXE] add <PATH>... 44 45Arguments: 46 <PATH>... Stuff to add 47 48Options: 49 -h, --help Print help 50 51``` 52 53A basic argument: 54```console 55$ git-derive add 56? failed 57adds things 58 59Usage: git-derive[EXE] add <PATH>... 60 61Arguments: 62 <PATH>... Stuff to add 63 64Options: 65 -h, --help Print help 66 67$ git-derive add Cargo.toml Cargo.lock 68Adding ["Cargo.toml", "Cargo.lock"] 69 70``` 71 72Default subcommand: 73```console 74$ git-derive stash -h 75Usage: git-derive[EXE] stash [OPTIONS] 76 git-derive[EXE] stash push [OPTIONS] 77 git-derive[EXE] stash pop [STASH] 78 git-derive[EXE] stash apply [STASH] 79 git-derive[EXE] stash help [COMMAND]... 80 81Options: 82 -m, --message <MESSAGE> 83 -h, --help Print help 84 85git-derive[EXE] stash push: 86 -m, --message <MESSAGE> 87 -h, --help Print help 88 89git-derive[EXE] stash pop: 90 -h, --help Print help 91 [STASH] 92 93git-derive[EXE] stash apply: 94 -h, --help Print help 95 [STASH] 96 97git-derive[EXE] stash help: 98Print this message or the help of the given subcommand(s) 99 [COMMAND]... Print help for the subcommand(s) 100 101$ git-derive stash push -h 102Usage: git-derive[EXE] stash push [OPTIONS] 103 104Options: 105 -m, --message <MESSAGE> 106 -h, --help Print help 107 108$ git-derive stash pop -h 109Usage: git-derive[EXE] stash pop [STASH] 110 111Arguments: 112 [STASH] 113 114Options: 115 -h, --help Print help 116 117$ git-derive stash -m "Prototype" 118Pushing StashPushArgs { message: Some("Prototype") } 119 120$ git-derive stash pop 121Popping None 122 123$ git-derive stash push -m "Prototype" 124Pushing StashPushArgs { message: Some("Prototype") } 125 126$ git-derive stash pop 127Popping None 128 129``` 130 131External subcommands: 132```console 133$ git-derive custom-tool arg1 --foo bar 134Calling out to "custom-tool" with ["arg1", "--foo", "bar"] 135 136``` 137 138Last argument: 139```console 140$ git-derive diff --help 141Compare two commits 142 143Usage: git-derive[EXE] diff [OPTIONS] [COMMIT] [COMMIT] [-- <PATH>] 144 145Arguments: 146 [COMMIT] 147 [COMMIT] 148 [PATH] 149 150Options: 151 --color[=<WHEN>] [default: auto] [possible values: always, auto, never] 152 -h, --help Print help 153 154$ git-derive diff 155Diffing stage..worktree (color=auto) 156 157$ git-derive diff ./src 158Diffing stage..worktree ./src (color=auto) 159 160$ git-derive diff HEAD ./src 161Diffing HEAD..worktree ./src (color=auto) 162 163$ git-derive diff HEAD~~ -- HEAD 164Diffing HEAD~~..worktree HEAD (color=auto) 165 166$ git-derive diff --color 167Diffing stage..worktree (color=always) 168 169$ git-derive diff --color=never 170Diffing stage..worktree (color=never) 171 172``` 173