git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Teemu Likonen <tlikonen@iki.fi>
Cc: git@vger.kernel.org, gitster@pobox.com
Subject: Re: [PATCH] bash: Add long option completion for 'git send-email'
Date: Tue, 15 Jul 2008 04:38:39 +0000	[thread overview]
Message-ID: <20080715043839.GE2432@spearce.org> (raw)
In-Reply-To: <1216023662-9109-1-git-send-email-tlikonen@iki.fi>

Teemu Likonen <tlikonen@iki.fi> wrote:
> Add the following long options to be completed with 'git send-email':
...
> Short ones like --to and --cc are not usable for actual completion

I agree, these are worth including.

> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index d268e6f..b15f3a9 100755
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -905,6 +905,24 @@ _git_rebase ()
>  	__gitcomp "$(__git_refs)"
>  }
>  
> +_git_send_email ()
> +{
> +	local cur="${COMP_WORDS[COMP_CWORD]}"
> +	case "$cur" in
> +	--*)
> +		__gitcomp "--bcc --cc --cc-cmd --chain-reply-to --compose
> +			--dry-run --envelope-sender --from --identity
> +			--in-reply-to --no-chain-reply-to --no-signed-off-by-cc
> +			--no-suppress-from --no-thread --quiet
> +			--signed-off-by-cc --smtp-pass --smtp-server
> +			--smtp-server-port --smtp-ssl --smtp-user --subject
> +			--suppress-cc --suppress-from --thread --to"
> +		return
> +		;;
> +	esac
> +	__git_complete_file

Don't use __git_complete_file here.  As far as I remember,
git-send-email does not accept "origin/maint:some.patch"
as an email to extract from Git prior to sending.  It looks
for files in the local filesystem.  So you want standard bash
completion for anything not starting with --.

Just use COMPREPLY=() at the end.  See _git_am for an example.

> @@ -1435,6 +1454,7 @@ complete -o default -o nospace -F _git_rebase git-rebase
>  complete -o default -o nospace -F _git_config git-config
>  complete -o default -o nospace -F _git_remote git-remote
>  complete -o default -o nospace -F _git_reset git-reset
> +complete -o default -o nospace -F _git_send_email git-send-email
>  complete -o default -o nospace -F _git_shortlog git-shortlog
>  complete -o default -o nospace -F _git_show git-show
>  complete -o default -o nospace -F _git_stash git-stash

Hmm.  With dash form commands gone in 1.6 we should remove these.

But I suspect this completion patch could be shipped in the next
1.5.6 maint release as its really quite trivial.  Junio, any comment
on that?

-- 
Shawn.

  reply	other threads:[~2008-07-15  4:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-14  8:21 [PATCH] bash: Add long option completion for 'git send-email' Teemu Likonen
2008-07-15  4:38 ` Shawn O. Pearce [this message]
2008-07-15  4:49   ` Junio C Hamano
2008-07-15  4:58     ` Shawn O. Pearce
2008-07-15  6:30   ` [PATCH v2] bash: Teach the bash completion about " Teemu Likonen
2008-07-15  6:31     ` Shawn O. Pearce
  -- strict thread matches above, loose matches on Subject: below --
2008-04-27  0:14 [PATCH] git-format-patch: add a new format.cc configuration variable Junio C Hamano
2008-04-27  5:09 ` [PATCH] bash: Add long option completion for 'git send-email' Teemu Likonen
2008-03-25 19:15 Teemu Likonen

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080715043839.GE2432@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=tlikonen@iki.fi \
    /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.
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 NNTP newsgroup(s).