git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] git help: promote 'git help -av'

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Sep 22, 2018, 19:29 UTC
Message-ID
<87fty1jppt.fsf@evledraar.gmail.com>
In-Reply-To
<20180922174707.16498-1-pclouds@gmail.com>
On Sat, Sep 22 2018, Nguyễn Thái Ngọc Duy wrote:
Show 25 quoted lines
> When you type "git help" (or just "git") you are greeted with a list
> with commonly used commands and their short description and are
> suggested to use "git help -a" or "git help -g" for more details.
>
> "git help -av" would be more friendly and inline with what is shown
> with "git help" since it shows list of commands with description as
> well, and commands are properly grouped.
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
>  git.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/git.c b/git.c
> index a6f4b44af5..69c21f378b 100644
> --- a/git.c
> +++ b/git.c
> @@ -31,7 +31,7 @@ const char git_usage_string[] =
>  	   "           <command> [<args>]");
>
>  const char git_more_info_string[] =
> -	N_("'git help -a' and 'git help -g' list available subcommands and some\n"
> +	N_("'git help -av' and 'git help -g' list available subcommands and some\n"
>  	   "concept guides. See 'git help <command>' or 'git help <concept>'\n"
>  	   "to read about a specific subcommand or concept.");

A side-effect of this not noted in your commit message is that we'll now invoke the pager, perhaps we should just do:

    diff --git a/builtin/help.c b/builtin/help.c
    index 8d4f6dd301..1a3b174aaf 100644
    --- a/builtin/help.c
    +++ b/builtin/help.c
    @@ -436,9 +436,9 @@ int cmd_help(int argc, const char **argv, const char *prefix)
            parsed_help_format = help_format;
            if (show_all) {
    +               setup_pager();
                    git_config(git_help_config, NULL);
                    if (verbose) {
    -                       setup_pager();
                            list_all_cmds_help();
                            return 0;
                    }
    @@ -460,8 +460,10 @@ int cmd_help(int argc, const char **argv, const char *prefix)
                    return 0;
            }
    -       if (show_guides)
    +       if (show_guides) {
    +               setup_pager();
                    list_common_guides_help();
    +       }
            if (show_all || show_guides) {
                    printf("%s\n", _(git_more_info_string));

Or is there a good reason we shouldn't invoke the pager for e.g. -g when the terminal is too small (per our default less config)?

Another thing I noticed: We don't list -v in the git-help manpage, but since we use OPT_VERBOSE it's supported.

Previous: Nguyễn Thái Ngọc DuyNext: Duy Nguyen
Message 2 of 18 in “git help: promote 'git help -av'”
  1. git help: promote 'git help -av'Nguyễn Thái Ngọc Duy, Sep 22, 2018
  2. Ævar Arnfjörð BjarmasonSep 22, 2018
  3. Duy NguyenSep 23, 2018
  4. Jeff KingSep 24, 2018
  5. Taylor BlauSep 24, 2018
  6. Jeff KingSep 24, 2018
  7. Junio C HamanoSep 24, 2018
  8. Duy NguyenSep 25, 2018
  9. Duy NguyenSep 25, 2018
  10. Jeff KingSep 25, 2018
  11. Duy NguyenSep 26, 2018
  12. Junio C HamanoSep 26, 2018
  13. Junio C HamanoSep 26, 2018
  14. Taylor BlauSep 28, 2018
  15. Junio C HamanoSep 28, 2018
  16. Taylor BlauSep 28, 2018
  17. help -a: improve and make --verbose defaultNguyễn Thái Ngọc Duy, Sep 29, 2018
  18. Taylor BlauOct 1, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.