git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Teemu Likonen <tlikonen@iki.fi>
To: Pieter de Bie <pdebie@ai.rug.nl>
Cc: Junio C Hamano <gitster@pobox.com>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	git@vger.kernel.org
Subject: Re: [PATCH] Add subcommand "help" to the list of most commonly used subcommands
Date: Fri, 6 Jun 2008 00:15:36 +0300	[thread overview]
Message-ID: <20080605211536.GA4328@mithlond.arda.local> (raw)
In-Reply-To: <408F1687-FC42-4E96-B641-088F200CE8D1@ai.rug.nl>

Pieter de Bie wrote (2008-06-05 20:38 +0200):

> On 5 jun 2008, at 20:13, Junio C Hamano wrote:
> 
> >See 'man git' and 'git help' for more information.
> 
> I'd like to see something more like
> 
> See 'git help COMMAND' for more information on a specific command

Sounds good. Here comes my first _ever_ attempt on C "programming". It
implements (i.e. tries to) what pretty much seems like an agreement on
the list: a separate info line after the command list. If the patch
sucks, well, at least I've had fun trying. And there's no need to ask me
to defend my code; I'm not able to answer. :-)

---snip---
Print info about "git help COMMAND" on git's main usage pages

Git's main usage pages did not show "git help" as a way to get more
information on a specific subcommand. This patch adds an info line after
the list of git commands currently printed by "git", "git help", "git
--help" and "git help --all".

Signed-off-by: Teemu Likonen <tlikonen@iki.fi>
---
 builtin.h |    1 +
 git.c     |    4 ++++
 help.c    |    2 ++
 3 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/builtin.h b/builtin.h
index 8bda111..b460b2d 100644
--- a/builtin.h
+++ b/builtin.h
@@ -5,6 +5,7 @@
 
 extern const char git_version_string[];
 extern const char git_usage_string[];
+extern const char git_more_info_string[];
 
 extern void list_common_cmds_help(void);
 extern void help_unknown_cmd(const char *cmd);
diff --git a/git.c b/git.c
index 272bf03..15a0e71 100644
--- a/git.c
+++ b/git.c
@@ -6,6 +6,9 @@
 const char git_usage_string[] =
 	"git [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate|--no-pager] [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE] [--help] COMMAND [ARGS]";
 
+const char git_more_info_string[] =
+	"See 'git help COMMAND' for more information on a specific command.";
+
 static int handle_options(const char*** argv, int* argc, int* envchanged)
 {
 	int handled = 0;
@@ -427,6 +430,7 @@ int main(int argc, const char **argv)
 		/* The user didn't specify a command; give them help */
 		printf("usage: %s\n\n", git_usage_string);
 		list_common_cmds_help();
+		printf("\n%s\n", git_more_info_string);
 		exit(1);
 	}
 	cmd = argv[0];
diff --git a/help.c b/help.c
index d89d437..8aff94c 100644
--- a/help.c
+++ b/help.c
@@ -649,12 +649,14 @@ int cmd_help(int argc, const char **argv, const char *prefix)
 	if (show_all) {
 		printf("usage: %s\n\n", git_usage_string);
 		list_commands();
+		printf("%s\n", git_more_info_string);
 		return 0;
 	}
 
 	if (!argv[0]) {
 		printf("usage: %s\n\n", git_usage_string);
 		list_common_cmds_help();
+		printf("\n%s\n", git_more_info_string);
 		return 0;
 	}
 
-- 
1.5.6.rc1.16.gc6796

  reply	other threads:[~2008-06-05 21:17 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-05  6:48 [TOY PATCH] git wrapper: show similar command names for an unknown command Johannes Schindelin
2008-06-05  8:19 ` [PATCH] Add subcommand "help" to the list of most commonly used subcommands Teemu Likonen
2008-06-05 10:32   ` Johannes Schindelin
2008-06-05 10:52     ` Teemu Likonen
2008-06-05 10:57       ` [PATCH v2 1/2] " Teemu Likonen
2008-06-05 10:57         ` [PATCH v2 2/2] More informative short description for git-help.txt Teemu Likonen
2008-06-05 12:58       ` [PATCH] Add subcommand "help" to the list of most commonly used subcommands Johannes Schindelin
2008-06-05 11:21     ` Sverre Rabbelier
2008-06-05 13:22       ` Teemu Likonen
2008-06-05 18:13   ` Junio C Hamano
2008-06-05 18:38     ` Pieter de Bie
2008-06-05 21:15       ` Teemu Likonen [this message]
2008-06-05 21:17       ` Junio C Hamano
2008-06-06  5:11         ` David Symonds
2008-06-05 18:42     ` Wincent Colaiuta
2008-06-05 19:15       ` Sverre Rabbelier
2008-06-05 20:59 ` [TOY PATCH] git wrapper: show similar command names for an unknown command Dirk Süsserott
2008-06-05 23:00   ` Johannes Schindelin
2008-06-06 12:15 ` Robin Rosenberg
2008-06-06 14:18   ` Wincent Colaiuta
2008-06-07  7:27 ` Alex Riesen
2008-06-07 15:04   ` Johannes Schindelin
2008-06-07 17:51     ` Alex Riesen
2008-06-07 18:08       ` Junio C Hamano
2008-06-08 15:07         ` Johannes Schindelin
2008-06-08 15:14           ` Dirk Süsserott
2008-06-08 17:53             ` Junio C Hamano
2008-06-08 23:26               ` Johannes Schindelin

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=20080605211536.GA4328@mithlond.arda.local \
    --to=tlikonen@iki.fi \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pdebie@ai.rug.nl \
    /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).