From: Eric Sunshine <sunshine@sunshineco.com>
To: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Cc: "Git List" <git@vger.kernel.org>,
"Stefan Beller" <sbeller@google.com>,
"Junio C Hamano" <gitster@pobox.com>,
"SZEDER Gábor" <szeder.dev@gmail.com>
Subject: Re: [PATCH v2 04/11] help: add --config to list all available config
Date: Sun, 27 May 2018 03:33:48 -0400 [thread overview]
Message-ID: <CAPig+cRbp1Kb2Nu-JihsxTaiWy5t=tNfVjTxGWVunyDuLu-71Q@mail.gmail.com> (raw)
In-Reply-To: <20180526135531.4516-5-pclouds@gmail.com>
On Sat, May 26, 2018 at 9:55 AM, Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:
> Sometimes it helps to list all available config vars so the user can
> search for something they want. The config man page can also be used
> but it's harder to search if you want to focus on the variable name,
> for example.
>
> This is not the best way to collect the available config since it's
> not precise. Ideally we should have a centralized list of config in C
> code (pretty much like 'struct option'), but that's a lot more work.
> This will do for now.
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
> diff --git a/help.c b/help.c
> @@ -409,6 +409,62 @@ void list_common_guides_help(void)
> +void list_config_help(void)
> +{
> + for (p = config_name_list; *p; p++) {
> + const char *var = *p;
> + struct strbuf sb = STRBUF_INIT;
> +
> + for (e = slot_expansions; e->prefix; e++) {
> +
> + strbuf_reset(&sb);
Style nit: unwanted blank line
> + strbuf_addf(&sb, "%s.%s", e->prefix, e->placeholder);
> + if (!strcasecmp(var, sb.buf)) {
> + e->fn(&keys, e->prefix);
> + e->found++;
> + break;
> + }
> + }
> + strbuf_release(&sb);
> + if (!e->prefix)
> + string_list_append(&keys, var);
> + }
next prev parent reply other threads:[~2018-05-27 7:33 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-10 14:19 [PATCH 0/9] completion: avoid hard coding config var list Nguyễn Thái Ngọc Duy
2018-05-10 14:19 ` [PATCH 1/9] Add and use generic name->id mapping code for color slot parsing Nguyễn Thái Ngọc Duy
2018-05-10 17:16 ` Stefan Beller
2018-05-11 7:22 ` Duy Nguyen
2018-05-10 14:19 ` [PATCH 2/9] grep: keep all colors in an array Nguyễn Thái Ngọc Duy
2018-05-10 14:19 ` [PATCH 3/9] fsck: factor out msg_id_info[] lazy initialization code Nguyễn Thái Ngọc Duy
2018-05-11 22:23 ` Eric Sunshine
2018-05-10 14:19 ` [PATCH 4/9] help: add --config to list all available config Nguyễn Thái Ngọc Duy
2018-05-11 22:39 ` Eric Sunshine
2018-05-10 14:19 ` [PATCH 5/9] advice: keep config name in camelCase in advice_config[] Nguyễn Thái Ngọc Duy
2018-05-10 14:19 ` [PATCH 6/9] am: move advice.amWorkDir parsing back to advice.c Nguyễn Thái Ngọc Duy
2018-05-11 22:42 ` Eric Sunshine
2018-05-10 14:19 ` [PATCH 7/9] completion: drop the hard coded list of config vars Nguyễn Thái Ngọc Duy
2018-05-11 22:47 ` Eric Sunshine
2018-05-20 16:01 ` SZEDER Gábor
2018-05-10 14:19 ` [PATCH 8/9] completion: support case-insensitive config vars just a bit Nguyễn Thái Ngọc Duy
2018-05-20 16:33 ` SZEDER Gábor
2018-05-10 14:19 ` [PATCH 9/9] log-tree: allow to customize 'grafted' color Nguyễn Thái Ngọc Duy
2018-05-10 14:22 ` [PATCH 0/9] completion: avoid hard coding config var list Duy Nguyen
2018-05-11 6:00 ` Junio C Hamano
2018-05-11 6:24 ` Duy Nguyen
2018-05-26 13:55 ` [PATCH v2 00/11] " Nguyễn Thái Ngọc Duy
2018-05-26 13:55 ` [PATCH v2 01/11] Add and use generic name->id mapping code for color slot parsing Nguyễn Thái Ngọc Duy
2018-05-29 17:41 ` Stefan Beller
2018-05-26 13:55 ` [PATCH v2 02/11] grep: keep all colors in an array Nguyễn Thái Ngọc Duy
2018-05-26 13:55 ` [PATCH v2 03/11] fsck: factor out msg_id_info[] lazy initialization code Nguyễn Thái Ngọc Duy
2018-05-26 13:55 ` [PATCH v2 04/11] help: add --config to list all available config Nguyễn Thái Ngọc Duy
2018-05-27 7:33 ` Eric Sunshine [this message]
2018-05-26 13:55 ` [PATCH v2 05/11] fsck: produce camelCase config key names Nguyễn Thái Ngọc Duy
2018-05-26 13:55 ` [PATCH v2 06/11] advice: keep config name in camelCase in advice_config[] Nguyễn Thái Ngọc Duy
2018-05-26 13:55 ` [PATCH v2 07/11] am: move advice.amWorkDir parsing back to advice.c Nguyễn Thái Ngọc Duy
2018-05-26 13:55 ` [PATCH v2 08/11] completion: drop the hard coded list of config vars Nguyễn Thái Ngọc Duy
2018-05-26 13:55 ` [PATCH v2 09/11] completion: keep other config var completion in camelCase Nguyễn Thái Ngọc Duy
2018-05-26 13:55 ` [PATCH v2 10/11] completion: support case-insensitive config vars Nguyễn Thái Ngọc Duy
2018-05-26 13:55 ` [PATCH v2 11/11] log-tree: allow to customize 'grafted' color Nguyễn Thái Ngọc Duy
2018-05-27 18:28 ` [PATCH v2 12/11] completion: complete general config vars in two steps Nguyễn Thái Ngọc Duy
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='CAPig+cRbp1Kb2Nu-JihsxTaiWy5t=tNfVjTxGWVunyDuLu-71Q@mail.gmail.com' \
--to=sunshine@sunshineco.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=pclouds@gmail.com \
--cc=sbeller@google.com \
--cc=szeder.dev@gmail.com \
/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).