From: Patrick Sudowe <patrick.sudowe@rwth-aachen.de>
To: git@vger.kernel.org
Cc: Patrick Sudowe <patrick.sudowe@rwth-aachen.de>
Subject: [PATCH] show help message also for aliased commands
Date: Thu, 18 Feb 2010 02:29:22 +0100 [thread overview]
Message-ID: <1266456562-88841-1-git-send-email-patrick.sudowe@rwth-aachen.de> (raw)
git help 'alias' currently only shows the actual git command
'alias' refers to. This patch changes the behavior so that
the help for the actual git command is shown. The user usually
knows the aliases defined, and sometimes its just more convenient
to type something like git help co than git help checkout
to find out about some rarely used option.
The original message is still there, so users do not face
unexpected or surprising behavior.
---
builtin-help.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/builtin-help.c b/builtin-help.c
index 3182a2b..4d8906d 100644
--- a/builtin-help.c
+++ b/builtin-help.c
@@ -416,6 +416,7 @@ int cmd_help(int argc, const char **argv, const char *prefix)
{
int nongit;
const char *alias;
+ const char *cmd;
enum help_format parsed_help_format;
load_command_list("git-", &main_cmds, &other_cmds);
@@ -446,19 +447,22 @@ int cmd_help(int argc, const char **argv, const char *prefix)
alias = alias_lookup(argv[0]);
if (alias && !is_git_command(argv[0])) {
printf("`git %s' is aliased to `%s'\n", argv[0], alias);
- return 0;
+ cmd = alias;
+ } else {
+ cmd = argv[0];
}
+
switch (help_format) {
case HELP_FORMAT_NONE:
case HELP_FORMAT_MAN:
- show_man_page(argv[0]);
+ show_man_page(cmd);
break;
case HELP_FORMAT_INFO:
- show_info_page(argv[0]);
+ show_info_page(cmd);
break;
case HELP_FORMAT_WEB:
- show_html_page(argv[0]);
+ show_html_page(cmd);
break;
}
--
1.7.0
next reply other threads:[~2010-02-18 1:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-18 1:29 Patrick Sudowe [this message]
2010-02-18 2:13 ` [PATCH] show help message also for aliased commands Junio C Hamano
2010-02-18 2:18 ` Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1266456562-88841-1-git-send-email-patrick.sudowe@rwth-aachen.de \
--to=patrick.sudowe@rwth-aachen.de \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).