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