{"thread":{"id":"15025","subject":"[PATCH] bash-completion: Add non-command git help files to bash-completion","startedAt":"2008-08-15T16:15:48Z","lastAt":"2008-08-16T09:30:37Z","messageCount":12,"participants":["Marcus Griep","Jonathan Nieder","Shawn O. Pearce","Junio C Hamano","Pieter de Bie"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"87324","messageId":"1218816948-7864-1-git-send-email-marcus@griep.us","threadId":"15025","inReplyTo":null,"subject":"[PATCH] bash-completion: Add non-command git help files to bash-completion","fromName":"Marcus Griep","fromEmail":"marcus@griep.us","sentAt":"2008-08-15T16:15:48Z","receivedAt":"2008-08-15T16:15:48Z","isPatch":true,"sender":{"key":"marcus@griep.us","avatar":"https://gravatar.com/avatar/0a841f2aad3f9a38c9bcf87a567c2a1751cb08924bae1bc46ee171395bcf9794?d=mp&s=160"},"body":"Git allows access to the gitattributes man page via `git help attributes`,\nbut this is not discoverable via the bash-completion mechanism.  This\npatch adds all current non-command man pages to the completion candidate\nlist.\n\nSigned-off-by: Marcus Griep <marcus@griep.us>\n---\n\n By adding them to the help completion, man pages such as the tutorials, hooks,\n and .gitattributes are more accessible to random discovery from bash-completion.\n\n contrib/completion/git-completion.bash |    6 +++++-\n 1 files changed, 5 insertions(+), 1 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex c0bf7aa..76d56eb 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -885,7 +885,11 @@ _git_help ()\n \t\treturn\n \t\t;;\n \tesac\n-\t__gitcomp \"$(__git_all_commands)\"\n+\t__gitcomp \"$(__git_all_commands)\n+\t\tattributes cli core-tutorial cvs-migration\n+\t\tdiffcore glossary hooks ignore k modules\n+\t\trepository-layout tutorial tutorial-2\n+\t\t\"\n }\n \n _git_init ()\n-- \n1.6.0.rc2.6.g8eda3\n"},{"id":"87329","messageId":"Pine.GSO.4.62.0808151234110.17004@harper.uchicago.edu","threadId":"15025","inReplyTo":"1218816948-7864-1-git-send-email-marcus@griep.us","subject":"Re: [PATCH] bash-completion: Add non-command git help files to bash-completion","fromName":"Jonathan Nieder","fromEmail":"jrnieder@uchicago.edu","sentAt":"2008-08-15T17:38:38Z","receivedAt":"2008-08-15T17:38:38Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nMarcus Griep wrote:\n\n> Git allows access to the gitattributes man page via `git help attributes`,\n> but this is not discoverable via the bash-completion mechanism.  This\n> patch adds all current non-command man pages to the completion candidate\n> list.\n[...]\n> +\t\tdiffcore glossary hooks ignore k modules\n\nI think k should be gitk here :)\n\nRegards,\nJonathan\n"},{"id":"87331","messageId":"48A5C29C.5080602@griep.us","threadId":"15025","inReplyTo":"Pine.GSO.4.62.0808151234110.17004@harper.uchicago.edu","subject":"Re: [PATCH] bash-completion: Add non-command git help files to bash-completion","fromName":"Marcus Griep","fromEmail":"marcus@griep.us","sentAt":"2008-08-15T17:53:32Z","receivedAt":"2008-08-15T17:53:32Z","isPatch":true,"sender":{"key":"marcus@griep.us","avatar":"https://gravatar.com/avatar/0a841f2aad3f9a38c9bcf87a567c2a1751cb08924bae1bc46ee171395bcf9794?d=mp&s=160"},"body":"It can be either.  In a bash-completion list, though, gitk would probably\nbe more recognizable.  I'll rehash that one.\n\nJonathan Nieder wrote:\n> Hi,\n> \n> Marcus Griep wrote:\n> \n>> Git allows access to the gitattributes man page via `git help attributes`,\n>> but this is not discoverable via the bash-completion mechanism.  This\n>> patch adds all current non-command man pages to the completion candidate\n>> list.\n> [...]\n>> +\t\tdiffcore glossary hooks ignore k modules\n> \n> I think k should be gitk here :)\n> \n> Regards,\n> Jonathan\n\n-- \nMarcus Griep\nGPG Key ID: 0x5E968152\n——\nhttp://www.boohaunt.net\nאת.ψο´\n"},{"id":"87332","messageId":"1218823168-1753-1-git-send-email-marcus@griep.us","threadId":"15025","inReplyTo":"1218816948-7864-1-git-send-email-marcus@griep.us","subject":"[PATCH v2] bash-completion: Add non-command git help files to bash-completion","fromName":"Marcus Griep","fromEmail":"marcus@griep.us","sentAt":"2008-08-15T17:59:28Z","receivedAt":"2008-08-15T17:59:28Z","isPatch":true,"sender":{"key":"marcus@griep.us","avatar":"https://gravatar.com/avatar/0a841f2aad3f9a38c9bcf87a567c2a1751cb08924bae1bc46ee171395bcf9794?d=mp&s=160"},"body":"Git allows access to the gitattributes man page via `git help attributes`,\nbut this is not discoverable via the bash-completion mechanism.  This\npatch adds all current non-command man pages to the completion candidate\nlist.\n\nSigned-off-by: Marcus Griep <marcus@griep.us>\n---\n\n By adding them to the help completion, man pages such as the tutorials, hooks,\n and .gitattributes are more accessible to random discovery from bash-completion.\n\n This patch also incorporates the suggestion that 'gitk' is an easier to grok\n completion than 'k'.\n\n contrib/completion/git-completion.bash |    6 +++++-\n 1 files changed, 5 insertions(+), 1 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex c0bf7aa..158b912 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -885,7 +885,11 @@ _git_help ()\n \t\treturn\n \t\t;;\n \tesac\n-\t__gitcomp \"$(__git_all_commands)\"\n+\t__gitcomp \"$(__git_all_commands)\n+\t\tattributes cli core-tutorial cvs-migration\n+\t\tdiffcore gitk glossary hooks ignore modules\n+\t\trepository-layout tutorial tutorial-2\n+\t\t\"\n }\n \n _git_init ()\n-- \n1.6.0.rc3.10.g5a13c\n"},{"id":"87333","messageId":"20080815180059.GA17399@spearce.org","threadId":"15025","inReplyTo":"1218823168-1753-1-git-send-email-marcus@griep.us","subject":"Re: [PATCH v2] bash-completion: Add non-command git help files to bash-completion","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-08-15T18:00:59Z","receivedAt":"2008-08-15T18:00:59Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Marcus Griep <marcus@griep.us> wrote:\n> Git allows access to the gitattributes man page via `git help attributes`,\n> but this is not discoverable via the bash-completion mechanism.  This\n> patch adds all current non-command man pages to the completion candidate\n> list.\n> \n> Signed-off-by: Marcus Griep <marcus@griep.us>\n\nAcked-by: Shawn O. Pearce <spearce@spearce.org>\n\n> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\n> index c0bf7aa..158b912 100755\n> --- a/contrib/completion/git-completion.bash\n> +++ b/contrib/completion/git-completion.bash\n> @@ -885,7 +885,11 @@ _git_help ()\n>  \t\treturn\n>  \t\t;;\n>  \tesac\n> -\t__gitcomp \"$(__git_all_commands)\"\n> +\t__gitcomp \"$(__git_all_commands)\n> +\t\tattributes cli core-tutorial cvs-migration\n> +\t\tdiffcore gitk glossary hooks ignore modules\n> +\t\trepository-layout tutorial tutorial-2\n> +\t\t\"\n>  }\n>  \n>  _git_init ()\n\n-- \nShawn.\n"},{"id":"87335","messageId":"7v8wuyb0m7.fsf@gitster.siamese.dyndns.org","threadId":"15025","inReplyTo":"1218816948-7864-1-git-send-email-marcus@griep.us","subject":"Re: [PATCH] bash-completion: Add non-command git help files to bash-completion","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-08-15T18:21:20Z","receivedAt":"2008-08-15T18:21:20Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Marcus Griep <marcus@griep.us> writes:\n\n> Git allows access to the gitattributes man page via `git help attributes`,\n> but this is not discoverable via the bash-completion mechanism.  This\n> patch adds all current non-command man pages to the completion candidate\n> list.\n\nI really do not think this belongs to completion.  \"git help topics\"\nperhaps.\n"},{"id":"87338","messageId":"48A5CC07.2040500@griep.us","threadId":"15025","inReplyTo":"7v8wuyb0m7.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] bash-completion: Add non-command git help files to bash-completion","fromName":"Marcus Griep","fromEmail":"marcus@griep.us","sentAt":"2008-08-15T18:33:43Z","receivedAt":"2008-08-15T18:33:43Z","isPatch":true,"sender":{"key":"marcus@griep.us","avatar":"https://gravatar.com/avatar/0a841f2aad3f9a38c9bcf87a567c2a1751cb08924bae1bc46ee171395bcf9794?d=mp&s=160"},"body":"Junio C Hamano wrote:\n> Marcus Griep <marcus@griep.us> writes:\n> \n>> Git allows access to the gitattributes man page via `git help attributes`,\n>> but this is not discoverable via the bash-completion mechanism.  This\n>> patch adds all current non-command man pages to the completion candidate\n>> list.\n> \n> I really do not think this belongs to completion.  \"git help topics\"\n> perhaps.\n\nI'm not sure I grok what you mean here...  These items are already accessible\nfrom `git help`, they just aren't discoverable through bash-completion without\nthe patch.\n\n-- \nMarcus Griep\nGPG Key ID: 0x5E968152\n——\nhttp://www.boohaunt.net\nאת.ψο´\n"},{"id":"87340","messageId":"7vvdy29kok.fsf@gitster.siamese.dyndns.org","threadId":"15025","inReplyTo":"48A5CC07.2040500@griep.us","subject":"Re: [PATCH] bash-completion: Add non-command git help files to bash-completion","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-08-15T18:50:51Z","receivedAt":"2008-08-15T18:50:51Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Marcus Griep <marcus@griep.us> writes:\n\n> Junio C Hamano wrote:\n>> Marcus Griep <marcus@griep.us> writes:\n>> \n>>> Git allows access to the gitattributes man page via `git help attributes`,\n>>> but this is not discoverable via the bash-completion mechanism.  This\n>>> patch adds all current non-command man pages to the completion candidate\n>>> list.\n>> \n>> I really do not think this belongs to completion.  \"git help topics\"\n>> perhaps.\n>\n> I'm not sure I grok what you mean here...  These items are already accessible\n> from `git help`, they just aren't discoverable...\n\nThat is exactly what I mean.  I do not think bloating shell completion to\nenumerate what help topics there are when the user hits \"git help <TAB>\"\nis a good idea to begin with.  It is a maintenance nightmere for one\nthing, and it does not help non-bash users.\n\n\t$ git help\n\t$ git help --all\n\nare existing ways for you to get list of \"command topics\" that you can ask\nthe help system about, but I do not see a way to ask \"git-help, please\ntell me what topics that are not git-commands can I ask you about?\", hence\nmy suggestion to add \"git help topics\".\n\nAnd if you based \"git help <TAB>\" completion on the output from such help\nsubcommand, you would not have to maintain the list of topics yourself in\nthe completion script, and I would not mind such a patch too much.\n"},{"id":"87342","messageId":"48A5D2EE.4080400@griep.us","threadId":"15025","inReplyTo":"7vvdy29kok.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] bash-completion: Add non-command git help files to bash-completion","fromName":"Marcus Griep","fromEmail":"marcus@griep.us","sentAt":"2008-08-15T19:03:10Z","receivedAt":"2008-08-15T19:03:10Z","isPatch":true,"sender":{"key":"marcus@griep.us","avatar":"https://gravatar.com/avatar/0a841f2aad3f9a38c9bcf87a567c2a1751cb08924bae1bc46ee171395bcf9794?d=mp&s=160"},"body":"Junio C Hamano wrote:\n> That is exactly what I mean.  I do not think bloating shell completion to\n> enumerate what help topics there are when the user hits \"git help <TAB>\"\n> is a good idea to begin with.  It is a maintenance nightmere for one\n> thing, and it does not help non-bash users.\n> \n> \t$ git help\n> \t$ git help --all\n> \n> are existing ways for you to get list of \"command topics\" that you can ask\n> the help system about, but I do not see a way to ask \"git-help, please\n> tell me what topics that are not git-commands can I ask you about?\", hence\n> my suggestion to add \"git help topics\".\n> \n> And if you based \"git help <TAB>\" completion on the output from such help\n> subcommand, you would not have to maintain the list of topics yourself in\n> the completion script, and I would not mind such a patch too much.\n\nGotcha.  A static list buried in git-completion.bash would be a maintenance\nheadache.  I can take a look at that some.\n\nWould we also want to look at doing something similar with '--' option\ncompletion, i.e. invoking the command with '-h' to get the usage and long\noptions, then building the completion list on that rather than the static\nlists it uses now?  The one downside to that is that some completions\ninclude trailing '=', which wouldn't be present in a usage list.\n\n-- \nMarcus Griep\nGPG Key ID: 0x5E968152\n——\nhttp://www.boohaunt.net\nאת.ψο´\n"},{"id":"87348","messageId":"B03ECD53-5920-4750-816F-890980C4CBD6@ai.rug.nl","threadId":"15025","inReplyTo":"7vvdy29kok.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] bash-completion: Add non-command git help files to bash-completion","fromName":"Pieter de Bie","fromEmail":"pdebie@ai.rug.nl","sentAt":"2008-08-15T20:32:16Z","receivedAt":"2008-08-15T20:32:16Z","isPatch":true,"sender":{"key":"pdebie@ai.rug.nl","avatar":null},"body":"\nOn 15 aug 2008, at 20:50, Junio C Hamano wrote:\n\n> That is exactly what I mean.  I do not think bloating shell  \n> completion to\n> enumerate what help topics there are when the user hits \"git help  \n> <TAB>\"\n> is a good idea to begin with.  It is a maintenance nightmere for one\n> thing, and it does not help non-bash users.\n>\n> \t$ git help\n> \t$ git help --all\n>\n> are existing ways for you to get list of \"command topics\" that you  \n> can ask\n> the help system about, but I do not see a way to ask \"git-help, please\n> tell me what topics that are not git-commands can I ask you about?\",  \n> hence\n> my suggestion to add \"git help topics\".\n>\n> And if you based \"git help <TAB>\" completion on the output from such  \n> help\n> subcommand, you would not have to maintain the list of topics  \n> yourself in\n> the completion script, and I would not mind such a patch too much.\n\nHow about something simple like this?\n\ndiff --git a/builtin-help.c b/builtin-help.c\nindex 391f749..a49b5c2 100644\n--- a/builtin-help.c\n+++ b/builtin-help.c\n@@ -446,6 +446,11 @@ int cmd_help(int argc, const char **argv, const  \nchar *prefix)\n                 return 0;\n         }\n\n+       if (!strcmp(\"man-path\", argv[0])) {\n+               printf(\"%s\\n\", GIT_MAN_PATH);\n+               return 0;\n+       }\n+\n         switch (help_format) {\n         case HELP_FORMAT_MAN:\n                 show_man_page(argv[0]);\ndiff --git a/contrib/completion/git-completion.bash b/contrib/ \ncompletion/git-completion.bash\nindex 3396e35..f781661 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -885,7 +885,8 @@ _git_help ()\n                 return\n                 ;;\n         esac\n-       __gitcomp \"$(__git_all_commands)\"\n+       __gitcomp \"$(ls $(./git help man-path)/man?/* |\n+         sed -n 's/^.*\\/git-\\{0,1\\}\\(.*\\)\\.[0-9]$/\\1/p')\"\n  }\n"},{"id":"87350","messageId":"48A5F265.5080905@griep.us","threadId":"15025","inReplyTo":"B03ECD53-5920-4750-816F-890980C4CBD6@ai.rug.nl","subject":"Re: [PATCH] bash-completion: Add non-command git help files to bash-completion","fromName":"Marcus Griep","fromEmail":"marcus@griep.us","sentAt":"2008-08-15T21:17:25Z","receivedAt":"2008-08-15T21:17:25Z","isPatch":true,"sender":{"key":"marcus@griep.us","avatar":"https://gravatar.com/avatar/0a841f2aad3f9a38c9bcf87a567c2a1751cb08924bae1bc46ee171395bcf9794?d=mp&s=160"},"body":"Pieter de Bie wrote:\n> How about something simple like this?\n\nSeems to do the job.\n\n> diff --git a/builtin-help.c b/builtin-help.c\n\nAre you working on next? Even though I know next is the new\nmaster. (master is soooo nearly last week. :-P)\n\nI had a slightly different take.  Your completion creates a 'k'\nfor gitk, which was suggested earlier in the thread suggested \nis a bit harder to grok.  This promotes 'git?' commands to use\n'git?' rather than '?' without affecting things otherwise.\n---\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex c0bf7aa..0bb0d79 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -885,7 +885,9 @@ _git_help ()\n                return\n                ;;\n        esac\n-       __gitcomp \"$(__git_all_commands)\"\n+       __gitcomp \"$(ls $(./git help man-path)/man?/* |\n+               sed -n -e 's/^.*\\/git-\\?\\(.\\{2,\\}\\)\\.[0-9]$/\\1/p' \\\n+                       -e 's/^.*\\/git\\(.\\)\\.[0-9]$/git\\1/p')\"\n }\n\n _git_init ()\ndiff --git a/help.c b/help.c\nindex 3cb1962..d0416e1 100644\n--- a/help.c\n+++ b/help.c\n@@ -717,6 +717,11 @@ int cmd_help(int argc, const char **argv, const char *prefix)\n                return 0;\n        }\n\n+       if (!strcmp(\"man-path\", argv[0])) {\n+               printf(\"%s\\n\", GIT_MAN_PATH);\n+               return 0;\n+       }\n+\n        switch (help_format) {\n        case HELP_FORMAT_MAN:\n                show_man_page(argv[0]);\n---\n\nWhat do you think, Junio?  If it works, I'll make this a\nnormal patch submission.\n\n-- \nMarcus Griep\nGPG Key ID: 0x5E968152\n——\nhttp://www.boohaunt.net\nאת.ψο´\n"},{"id":"87369","messageId":"7vskt5gvcy.fsf@gitster.siamese.dyndns.org","threadId":"15025","inReplyTo":"20080815180059.GA17399@spearce.org","subject":"Re: [PATCH v2] bash-completion: Add non-command git help files to bash-completion","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-08-16T09:30:37Z","receivedAt":"2008-08-16T09:30:37Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Shawn O. Pearce\" <spearce@spearce.org> writes:\n\n> Marcus Griep <marcus@griep.us> wrote:\n>> Git allows access to the gitattributes man page via `git help attributes`,\n>> but this is not discoverable via the bash-completion mechanism.  This\n>> patch adds all current non-command man pages to the completion candidate\n>> list.\n>> \n>> Signed-off-by: Marcus Griep <marcus@griep.us>\n>\n> Acked-by: Shawn O. Pearce <spearce@spearce.org>\n\nI'd honor this Ack for 1.6.0 and will apply the patch as-is, but that does\nnot mean I do not think this is a wrong approach in the longer run.\n"}]}