From: Junio C Hamano <gitster@pobox.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: "Jean-Noël AVILA" <avila.jn@gmail.com>,
"Torsten Bögershausen" <tboegi@web.de>,
"Jeff King" <peff@peff.net>,
git@vger.kernel.org, "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>,
"Felipe Contreras" <felipe.contreras@gmail.com>
Subject: Re: t9902 fails
Date: Fri, 18 Jan 2013 12:15:23 -0800 [thread overview]
Message-ID: <7vmww6qmck.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <7v8v7qsagd.fsf@alter.siamese.dyndns.org> (Junio C. Hamano's message of "Fri, 18 Jan 2013 08:49:22 -0800")
Junio C Hamano <gitster@pobox.com> writes:
> How about doing something like this and set that variable in the
> test instead? If STD_ONLY is not set, you will get everything, but
> when STD_ONLY is set, we will stop reading from "help -a" when it
> starts listing additional stuff.
>
> contrib/completion/git-completion.bash | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index a4c48e1..415a078 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -534,7 +534,8 @@ __git_complete_strategy ()
> __git_list_all_commands ()
> {
> local i IFS=" "$'\n'
> - for i in $(git help -a|egrep '^ [a-zA-Z0-9]')
> + for i in $(LANG=C LC_ALL=C git help -a |
> + sed -n ${GIT_HELP_STD_ONLY+-e /^git.*elsewhere/q} -e '/^ [a-zA-Z0-9]/p')
> do
> case $i in
> *--*) : helper pattern;;
Alternatively, we could do this and replace everything inside $()
with "git help --standard", but that requires the completion script
update to go in sync with the core update, which is a downside.
builtin/help.c | 21 +++++++++++++++++----
help.c | 3 +++
2 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/builtin/help.c b/builtin/help.c
index bd86253..e6b9b5f 100644
--- a/builtin/help.c
+++ b/builtin/help.c
@@ -36,11 +36,16 @@ enum help_format {
static const char *html_path;
-static int show_all = 0;
+#define HELP_ALL 1
+#define HELP_STANDARD 2
+static int show_what;
static unsigned int colopts;
static enum help_format help_format = HELP_FORMAT_NONE;
static struct option builtin_help_options[] = {
- OPT_BOOLEAN('a', "all", &show_all, N_("print all available commands")),
+ OPT_SET_INT('a', "all", &show_what, N_("print all available commands"),
+ HELP_ALL),
+ OPT_SET_INT(0, "standard", &show_what, N_("list subcommands that comes with git"),
+ HELP_STANDARD),
OPT_SET_INT('m', "man", &help_format, N_("show man page"), HELP_FORMAT_MAN),
OPT_SET_INT('w', "web", &help_format, N_("show manual in web browser"),
HELP_FORMAT_WEB),
@@ -436,19 +441,27 @@ int cmd_help(int argc, const char **argv, const char *prefix)
int nongit;
const char *alias;
enum help_format parsed_help_format;
- load_command_list("git-", &main_cmds, &other_cmds);
argc = parse_options(argc, argv, prefix, builtin_help_options,
builtin_help_usage, 0);
parsed_help_format = help_format;
- if (show_all) {
+ load_command_list("git-", &main_cmds,
+ show_what == HELP_STANDARD ? NULL : &other_cmds);
+
+ if (show_what == HELP_ALL) {
git_config(git_help_config, NULL);
printf(_("usage: %s%s"), _(git_usage_string), "\n\n");
list_commands(colopts, &main_cmds, &other_cmds);
printf("%s\n", _(git_more_info_string));
return 0;
}
+ if (show_what == HELP_STANDARD) {
+ int i;
+ for (i = 0; i < main_cmds.cnt; i++)
+ printf("%s\n", main_cmds.names[i]->name);
+ return 0;
+ }
if (!argv[0]) {
printf(_("usage: %s%s"), _(git_usage_string), "\n\n");
diff --git a/help.c b/help.c
index 2a42ec6..3e6b04c 100644
--- a/help.c
+++ b/help.c
@@ -182,6 +182,9 @@ void load_command_list(const char *prefix,
uniq(main_cmds);
}
+ if (!other_cmds)
+ return;
+
if (env_path) {
char *paths, *path, *colon;
path = paths = xstrdup(env_path);
next prev parent reply other threads:[~2013-01-18 20:15 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-15 13:35 [PATCH] attr: fix off-by-one directory component length calculation Nguyễn Thái Ngọc Duy
2013-01-15 16:17 ` Junio C Hamano
2013-01-15 19:14 ` Jean-Noël AVILA
2013-01-15 19:29 ` Junio C Hamano
2013-01-15 19:53 ` Jean-Noël AVILA
2013-01-15 20:49 ` Junio C Hamano
2013-01-15 23:24 ` Jeff King
2013-01-16 6:15 ` t9902 fails (Was: [PATCH] attr: fix off-by-one directory component length calculation) Torsten Bögershausen
2013-01-17 22:47 ` Jean-Noël AVILA
2013-01-18 0:04 ` Jonathan Nieder
2013-01-18 0:12 ` t9902 fails Junio C Hamano
2013-01-18 5:20 ` t9902 fails (Was: [PATCH] attr: fix off-by-one directory component length calculation) Torsten Bögershausen
2013-01-18 16:49 ` t9902 fails Junio C Hamano
2013-01-18 20:15 ` Junio C Hamano [this message]
2013-01-18 22:23 ` Jean-Noël AVILA
2013-01-18 22:37 ` Junio C Hamano
2013-01-18 22:57 ` Junio C Hamano
2013-01-19 5:38 ` Torsten Bögershausen
2013-01-19 7:52 ` Re* " Junio C Hamano
2013-01-19 8:00 ` [PATCH 1/2] help: include <common-cmds.h> only in one file Junio C Hamano
2013-01-19 8:02 ` [PATCH 2/2] help --standard: list standard commands Junio C Hamano
2013-01-19 10:32 ` Jean-Noël AVILA
2013-01-19 13:43 ` Re* t9902 fails Jean-Noël AVILA
2013-01-19 10:23 ` Jean-Noël AVILA
2013-01-16 1:08 ` [PATCH] attr: fix off-by-one directory component length calculation Duy Nguyen
2013-01-16 2:09 ` Duy Nguyen
2013-01-16 2:33 ` Junio C Hamano
2013-01-16 3:12 ` Duy Nguyen
2013-01-16 5:35 ` Junio C Hamano
2013-01-16 6:02 ` Duy Nguyen
2013-01-16 19:07 ` Junio C Hamano
2013-01-16 1:03 ` Duy Nguyen
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vmww6qmck.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=avila.jn@gmail.com \
--cc=felipe.contreras@gmail.com \
--cc=git@vger.kernel.org \
--cc=jrnieder@gmail.com \
--cc=pclouds@gmail.com \
--cc=peff@peff.net \
--cc=tboegi@web.de \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).