diff options
author | Rasmus Villemoes <rv@rasmusvillemoes.dk> | 2018-10-09 13:59:08 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-10-11 10:21:43 +0900 |
commit | a9a60b94ccda5ff25faf51f39faeac11cac68346 (patch) | |
tree | 561986a58b5c736b4f5b993a9de882ef2168a991 /t/t7519 | |
parent | help: redirect to aliased commands for "git cmd --help" (diff) | |
download | tgif-a9a60b94ccda5ff25faf51f39faeac11cac68346.tar.xz |
git.c: handle_alias: prepend alias info when first argument is -h
Most git commands respond to -h anywhere in the command line, or at
least as a first and lone argument, by printing the usage
information. For aliases, we can provide a little more information that
might be useful in interpreting/understanding the following output by
prepending a line telling that the command is an alias, and for what.
When one invokes a simple alias, such as "cp = cherry-pick"
with -h, this results in
$ git cp -h
'cp' is aliased to 'cherry-pick'
usage: git cherry-pick [<options>] <commit-ish>...
...
When the alias consists of more than one word, this provides the
additional benefit of informing the user which options are implicit in
using the alias, e.g. with "cp = cherry-pick -n":
$ git cp -h
'cp' is aliased to 'cherry-pick -n'
usage: git cherry-pick [<options>] <commit-ish>...
...
For shell commands, we cannot know how it responds to -h, but printing
this line to stderr should not hurt, and can help in figuring out what
is happening in a case like
$ git sc -h
'sc' is aliased to '!somecommand'
somecommand: invalid option '-h'
Suggested-by: Jeff King <peff@peff.net>
Signed-off-by: Rasmus Villemoes <rv@rasmusvillemoes.dk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7519')
0 files changed, 0 insertions, 0 deletions