{"thread":{"id":"14444","subject":"[PATCH] bash: Add long option completion for 'git send-email'","startedAt":"2008-07-14T08:21:02Z","lastAt":"2008-07-15T06:31:53Z","messageCount":6,"participants":["Teemu Likonen","Shawn O. Pearce","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"83236","messageId":"1216023662-9109-1-git-send-email-tlikonen@iki.fi","threadId":"14444","inReplyTo":null,"subject":"[PATCH] bash: Add long option completion for 'git send-email'","fromName":"Teemu Likonen","fromEmail":"tlikonen@iki.fi","sentAt":"2008-07-14T08:21:02Z","receivedAt":"2008-07-14T08:21:02Z","isPatch":true,"sender":{"key":"tlikonen@iki.fi","avatar":null},"body":"Add the following long options to be completed with 'git send-email':\n\n    --bcc --cc --cc-cmd --chain-reply-to --compose --dry-run\n    --envelope-sender --from --identity --in-reply-to\n    --no-chain-reply-to --no-signed-off-by-cc --no-suppress-from\n    --no-thread --quiet --signed-off-by-cc --smtp-pass --smtp-server\n    --smtp-server-port --smtp-ssl --smtp-user --subject --suppress-cc\n    --suppress-from --thread --to\n\nShort ones like --to and --cc are not usable for actual completion\nbecause of the shortness itself and because there are longer ones which\nstart with same letters (--thread, --compose). It's still useful to have\nthese shorter options _listed_ when user presses TAB key after typing\ntwo dashes. It gives user an idea what options are available (and --to\nand --cc are probably the most commonly used).\n\nSigned-off-by: Teemu Likonen <tlikonen@iki.fi>\n---\n contrib/completion/git-completion.bash |   20 ++++++++++++++++++++\n 1 files changed, 20 insertions(+), 0 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex d268e6f..b15f3a9 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -905,6 +905,24 @@ _git_rebase ()\n \t__gitcomp \"$(__git_refs)\"\n }\n \n+_git_send_email ()\n+{\n+\tlocal cur=\"${COMP_WORDS[COMP_CWORD]}\"\n+\tcase \"$cur\" in\n+\t--*)\n+\t\t__gitcomp \"--bcc --cc --cc-cmd --chain-reply-to --compose\n+\t\t\t--dry-run --envelope-sender --from --identity\n+\t\t\t--in-reply-to --no-chain-reply-to --no-signed-off-by-cc\n+\t\t\t--no-suppress-from --no-thread --quiet\n+\t\t\t--signed-off-by-cc --smtp-pass --smtp-server\n+\t\t\t--smtp-server-port --smtp-ssl --smtp-user --subject\n+\t\t\t--suppress-cc --suppress-from --thread --to\"\n+\t\treturn\n+\t\t;;\n+\tesac\n+\t__git_complete_file\n+}\n+\n _git_config ()\n {\n \tlocal cur=\"${COMP_WORDS[COMP_CWORD]}\"\n@@ -1376,6 +1394,7 @@ _git ()\n \trebase)      _git_rebase ;;\n \tremote)      _git_remote ;;\n \treset)       _git_reset ;;\n+\tsend-email)  _git_send_email ;;\n \tshortlog)    _git_shortlog ;;\n \tshow)        _git_show ;;\n \tshow-branch) _git_log ;;\n@@ -1435,6 +1454,7 @@ complete -o default -o nospace -F _git_rebase git-rebase\n complete -o default -o nospace -F _git_config git-config\n complete -o default -o nospace -F _git_remote git-remote\n complete -o default -o nospace -F _git_reset git-reset\n+complete -o default -o nospace -F _git_send_email git-send-email\n complete -o default -o nospace -F _git_shortlog git-shortlog\n complete -o default -o nospace -F _git_show git-show\n complete -o default -o nospace -F _git_stash git-stash\n-- \n1.5.6.3.316.g01fc\n"},{"id":"83356","messageId":"20080715043839.GE2432@spearce.org","threadId":"14444","inReplyTo":"1216023662-9109-1-git-send-email-tlikonen@iki.fi","subject":"Re: [PATCH] bash: Add long option completion for 'git send-email'","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-07-15T04:38:39Z","receivedAt":"2008-07-15T04:38:39Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Teemu Likonen <tlikonen@iki.fi> wrote:\n> Add the following long options to be completed with 'git send-email':\n...\n> Short ones like --to and --cc are not usable for actual completion\n\nI agree, these are worth including.\n\n> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\n> index d268e6f..b15f3a9 100755\n> --- a/contrib/completion/git-completion.bash\n> +++ b/contrib/completion/git-completion.bash\n> @@ -905,6 +905,24 @@ _git_rebase ()\n>  \t__gitcomp \"$(__git_refs)\"\n>  }\n>  \n> +_git_send_email ()\n> +{\n> +\tlocal cur=\"${COMP_WORDS[COMP_CWORD]}\"\n> +\tcase \"$cur\" in\n> +\t--*)\n> +\t\t__gitcomp \"--bcc --cc --cc-cmd --chain-reply-to --compose\n> +\t\t\t--dry-run --envelope-sender --from --identity\n> +\t\t\t--in-reply-to --no-chain-reply-to --no-signed-off-by-cc\n> +\t\t\t--no-suppress-from --no-thread --quiet\n> +\t\t\t--signed-off-by-cc --smtp-pass --smtp-server\n> +\t\t\t--smtp-server-port --smtp-ssl --smtp-user --subject\n> +\t\t\t--suppress-cc --suppress-from --thread --to\"\n> +\t\treturn\n> +\t\t;;\n> +\tesac\n> +\t__git_complete_file\n\nDon't use __git_complete_file here.  As far as I remember,\ngit-send-email does not accept \"origin/maint:some.patch\"\nas an email to extract from Git prior to sending.  It looks\nfor files in the local filesystem.  So you want standard bash\ncompletion for anything not starting with --.\n\nJust use COMPREPLY=() at the end.  See _git_am for an example.\n\n> @@ -1435,6 +1454,7 @@ complete -o default -o nospace -F _git_rebase git-rebase\n>  complete -o default -o nospace -F _git_config git-config\n>  complete -o default -o nospace -F _git_remote git-remote\n>  complete -o default -o nospace -F _git_reset git-reset\n> +complete -o default -o nospace -F _git_send_email git-send-email\n>  complete -o default -o nospace -F _git_shortlog git-shortlog\n>  complete -o default -o nospace -F _git_show git-show\n>  complete -o default -o nospace -F _git_stash git-stash\n\nHmm.  With dash form commands gone in 1.6 we should remove these.\n\nBut I suspect this completion patch could be shipped in the next\n1.5.6 maint release as its really quite trivial.  Junio, any comment\non that?\n\n-- \nShawn.\n"},{"id":"83358","messageId":"7vmykjda5i.fsf@gitster.siamese.dyndns.org","threadId":"14444","inReplyTo":"20080715043839.GE2432@spearce.org","subject":"Re: [PATCH] bash: Add long option completion for 'git send-email'","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-07-15T04:49:29Z","receivedAt":"2008-07-15T04:49:29Z","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> Hmm.  With dash form commands gone in 1.6 we should remove these.\n>\n> But I suspect this completion patch could be shipped in the next\n> 1.5.6 maint release as its really quite trivial.  Junio, any comment\n> on that?\n\nYeah, it is trivial but does it deserve \"bugfix -- we need to deliver this\nchange to the end users, otherwise they will suffer\" label?  Probably not.\n"},{"id":"83359","messageId":"20080715045856.GH2432@spearce.org","threadId":"14444","inReplyTo":"7vmykjda5i.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] bash: Add long option completion for 'git send-email'","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-07-15T04:58:56Z","receivedAt":"2008-07-15T04:58:56Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Junio C Hamano <gitster@pobox.com> wrote:\n> \"Shawn O. Pearce\" <spearce@spearce.org> writes:\n> \n> > Hmm.  With dash form commands gone in 1.6 we should remove these.\n> >\n> > But I suspect this completion patch could be shipped in the next\n> > 1.5.6 maint release as its really quite trivial.  Junio, any comment\n> > on that?\n> \n> Yeah, it is trivial but does it deserve \"bugfix -- we need to deliver this\n> change to the end users, otherwise they will suffer\" label?  Probably not.\n\nNot really, but we have shipped new completion functionality (missing\n--graph option to git-log) in maint releases in recent history.\n\nIf it was me maintaining git.git, I'd probably toss this into maint.\nBut I think I have a more aggressive personality than you, and am\nmore willing to take a risk.  Users frequently don't like such risk.\n\nI defer to your wise judgement.  Given prior statements about what\ngoes where, you are being consistent to say this should go in 1.6.\nIn which case I suggest Teemu should drop that last hunk as we\nshould really drop that entire block of code from the script.\n\n-- \nShawn.\n"},{"id":"83367","messageId":"20080715063034.GA3316@mithlond.arda.local","threadId":"14444","inReplyTo":"20080715043839.GE2432@spearce.org","subject":"[PATCH v2] bash: Teach the bash completion about 'git send-email'","fromName":"Teemu Likonen","fromEmail":"tlikonen@iki.fi","sentAt":"2008-07-15T06:30:34Z","receivedAt":"2008-07-15T06:30:34Z","isPatch":true,"sender":{"key":"tlikonen@iki.fi","avatar":null},"body":"Add the following long options to be completed with 'git send-email':\n\n    --bcc --cc --cc-cmd --chain-reply-to --compose --dry-run\n    --envelope-sender --from --identity --in-reply-to\n    --no-chain-reply-to --no-signed-off-by-cc --no-suppress-from\n    --no-thread --quiet --signed-off-by-cc --smtp-pass --smtp-server\n    --smtp-server-port --smtp-ssl --smtp-user --subject --suppress-cc\n    --suppress-from --thread --to\n\nShort ones like --to and --cc are not usable for actual completion\nbecause of the shortness itself and because there are longer ones which\nstart with same letters (--thread, --compose). It's still useful to have\nthese shorter options _listed_ when user presses TAB key after typing\ntwo dashes. It gives user an idea what options are available (and --to\nand --cc are probably the most commonly used).\n\nSigned-off-by: Teemu Likonen <tlikonen@iki.fi>\n---\n\nShawn O. Pearce wrote (2008-07-15 04:38 +0000):\n\n> Don't use __git_complete_file here.  As far as I remember,\n> git-send-email does not accept \"origin/maint:some.patch\" as an email\n> to extract from Git prior to sending.  It looks for files in the local\n> filesystem.  So you want standard bash completion for anything not\n> starting with --.\n> \n> Just use COMPREPLY=() at the end.  See _git_am for an example.\n\nDone. And thanks.\n\n> > +complete -o default -o nospace -F _git_send_email git-send-email\n\n> Hmm.  With dash form commands gone in 1.6 we should remove these.\n> \n> But I suspect this completion patch could be shipped in the next 1.5.6\n> maint release as its really quite trivial.  Junio, any comment on\n> that?\n\nThis is a for-1.6 version so the completion for dashed command\n(git-send-email) is dropped. I see Shawn already sent a patch which\ndrops all those.\n\n\n\n contrib/completion/git-completion.bash |   19 +++++++++++++++++++\n 1 files changed, 19 insertions(+), 0 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex d268e6f..48ebbf7 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -905,6 +905,24 @@ _git_rebase ()\n \t__gitcomp \"$(__git_refs)\"\n }\n \n+_git_send_email ()\n+{\n+\tlocal cur=\"${COMP_WORDS[COMP_CWORD]}\"\n+\tcase \"$cur\" in\n+\t--*)\n+\t\t__gitcomp \"--bcc --cc --cc-cmd --chain-reply-to --compose\n+\t\t\t--dry-run --envelope-sender --from --identity\n+\t\t\t--in-reply-to --no-chain-reply-to --no-signed-off-by-cc\n+\t\t\t--no-suppress-from --no-thread --quiet\n+\t\t\t--signed-off-by-cc --smtp-pass --smtp-server\n+\t\t\t--smtp-server-port --smtp-ssl --smtp-user --subject\n+\t\t\t--suppress-cc --suppress-from --thread --to\"\n+\t\treturn\n+\t\t;;\n+\tesac\n+\tCOMPREPLY=()\n+}\n+\n _git_config ()\n {\n \tlocal cur=\"${COMP_WORDS[COMP_CWORD]}\"\n@@ -1376,6 +1394,7 @@ _git ()\n \trebase)      _git_rebase ;;\n \tremote)      _git_remote ;;\n \treset)       _git_reset ;;\n+\tsend-email)  _git_send_email ;;\n \tshortlog)    _git_shortlog ;;\n \tshow)        _git_show ;;\n \tshow-branch) _git_log ;;\n-- \n1.5.6.3.316.g01fc\n"},{"id":"83368","messageId":"20080715063153.GA3638@spearce.org","threadId":"14444","inReplyTo":"20080715063034.GA3316@mithlond.arda.local","subject":"Re: [PATCH v2] bash: Teach the bash completion about 'git send-email'","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-07-15T06:31:53Z","receivedAt":"2008-07-15T06:31:53Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Teemu Likonen <tlikonen@iki.fi> wrote:\n> Add the following long options to be completed with 'git send-email':\n> \n>     --bcc --cc --cc-cmd --chain-reply-to --compose --dry-run\n>     --envelope-sender --from --identity --in-reply-to\n>     --no-chain-reply-to --no-signed-off-by-cc --no-suppress-from\n>     --no-thread --quiet --signed-off-by-cc --smtp-pass --smtp-server\n>     --smtp-server-port --smtp-ssl --smtp-user --subject --suppress-cc\n>     --suppress-from --thread --to\n> \n> Short ones like --to and --cc are not usable for actual completion\n> because of the shortness itself and because there are longer ones which\n> start with same letters (--thread, --compose). It's still useful to have\n> these shorter options _listed_ when user presses TAB key after typing\n> two dashes. It gives user an idea what options are available (and --to\n> and --cc are probably the most commonly used).\n> \n> Signed-off-by: Teemu Likonen <tlikonen@iki.fi>\n\nAcked-by: Shawn O. Pearce <spearce@spearce.org>\n\nThanks for the quick reply cleaning up the minor details.  :)\n\n\n> Shawn O. Pearce wrote (2008-07-15 04:38 +0000):\n> \n> > Don't use __git_complete_file here.  As far as I remember,\n> > git-send-email does not accept \"origin/maint:some.patch\" as an email\n> > to extract from Git prior to sending.  It looks for files in the local\n> > filesystem.  So you want standard bash completion for anything not\n> > starting with --.\n> > \n> > Just use COMPREPLY=() at the end.  See _git_am for an example.\n> \n> Done. And thanks.\n> \n> > > +complete -o default -o nospace -F _git_send_email git-send-email\n> \n> > Hmm.  With dash form commands gone in 1.6 we should remove these.\n> > \n> > But I suspect this completion patch could be shipped in the next 1.5.6\n> > maint release as its really quite trivial.  Junio, any comment on\n> > that?\n> \n> This is a for-1.6 version so the completion for dashed command\n> (git-send-email) is dropped. I see Shawn already sent a patch which\n> drops all those.\n> \n> \n> \n>  contrib/completion/git-completion.bash |   19 +++++++++++++++++++\n>  1 files changed, 19 insertions(+), 0 deletions(-)\n> \n> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\n> index d268e6f..48ebbf7 100755\n> --- a/contrib/completion/git-completion.bash\n> +++ b/contrib/completion/git-completion.bash\n> @@ -905,6 +905,24 @@ _git_rebase ()\n>  \t__gitcomp \"$(__git_refs)\"\n>  }\n>  \n> +_git_send_email ()\n> +{\n> +\tlocal cur=\"${COMP_WORDS[COMP_CWORD]}\"\n> +\tcase \"$cur\" in\n> +\t--*)\n> +\t\t__gitcomp \"--bcc --cc --cc-cmd --chain-reply-to --compose\n> +\t\t\t--dry-run --envelope-sender --from --identity\n> +\t\t\t--in-reply-to --no-chain-reply-to --no-signed-off-by-cc\n> +\t\t\t--no-suppress-from --no-thread --quiet\n> +\t\t\t--signed-off-by-cc --smtp-pass --smtp-server\n> +\t\t\t--smtp-server-port --smtp-ssl --smtp-user --subject\n> +\t\t\t--suppress-cc --suppress-from --thread --to\"\n> +\t\treturn\n> +\t\t;;\n> +\tesac\n> +\tCOMPREPLY=()\n> +}\n> +\n>  _git_config ()\n>  {\n>  \tlocal cur=\"${COMP_WORDS[COMP_CWORD]}\"\n> @@ -1376,6 +1394,7 @@ _git ()\n>  \trebase)      _git_rebase ;;\n>  \tremote)      _git_remote ;;\n>  \treset)       _git_reset ;;\n> +\tsend-email)  _git_send_email ;;\n>  \tshortlog)    _git_shortlog ;;\n>  \tshow)        _git_show ;;\n>  \tshow-branch) _git_log ;;\n> -- \n> 1.5.6.3.316.g01fc\n> \n\n-- \nShawn.\n"}]}