Re: [PATCH v2 04/11] help: add --config to list all available config

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, May 26, 2018 at 9:55 AM, Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> 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@xxxxxxxxx>
> ---
> 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);
> +       }




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux