* [RFC/PATCH] completion: complete pretty format placeholders
@ 2009-05-16 10:07 Stephen Boyd
2009-05-20 22:52 ` Shawn O. Pearce
0 siblings, 1 reply; 3+ messages in thread
From: Stephen Boyd @ 2009-05-16 10:07 UTC (permalink / raw)
To: git; +Cc: Shawn O. Pearce
---
This seems to work most of the time.
This
git log --pretty=format:%ad:%<TAB>
becomes
git log --pretty=format:%ad:%ad:%
which is wrong.
But in quotes
git log --pretty=format:"%ad:%<TAB>
works.
I'm not sure why.
Also git log --pretty=%<TAB> doesn't work. I'm not sure how to support
that without encountering the same breakage as above.
contrib/completion/git-completion.bash | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index ad26b7c..3819c73 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1117,6 +1117,9 @@ __git_log_shortlog_options="
__git_log_pretty_formats="oneline short medium full fuller email raw format:"
__git_log_date_formats="relative iso8601 rfc2822 short local default raw"
+__git_log_format_placeholders="ad aD ae aE ai an aN ar at b Cblue cd cD ce cE
+Cgreen ci cn cN cr Cred Creset ct d e f h H m n p P s t T x
+"
_git_log ()
{
@@ -1129,6 +1132,17 @@ _git_log ()
merge="--merge"
fi
case "$cur" in
+ --pretty=format:*%*|--format=format:*%*)
+ local pfx="${cur%\%*}%"
+ pfx="${pfx#*:}"
+ cur="${cur##*%}"
+ __gitcomp "$__git_log_format_placeholders
+ " "$pfx" "$cur"
+ return
+ ;;
+ --pretty=format:*|--format=format:*)
+ return
+ ;;
--pretty=*)
__gitcomp "$__git_log_pretty_formats
" "" "${cur##--pretty=}"
@@ -1814,6 +1828,17 @@ _git_show ()
local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in
+ --pretty=format:*%*|--format=format:*%*)
+ local pfx="${cur%\%*}%"
+ pfx="${pfx#*:}"
+ cur="${cur##*%}"
+ __gitcomp "$__git_log_format_placeholders
+ " "$pfx" "$cur"
+ return
+ ;;
+ --pretty=format:*|--format=format:*)
+ return
+ ;;
--pretty=*)
__gitcomp "$__git_log_pretty_formats
" "" "${cur##--pretty=}"
--
1.6.3.1.9.g95405b
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [RFC/PATCH] completion: complete pretty format placeholders
2009-05-16 10:07 [RFC/PATCH] completion: complete pretty format placeholders Stephen Boyd
@ 2009-05-20 22:52 ` Shawn O. Pearce
2009-05-21 3:59 ` Stephen Boyd
0 siblings, 1 reply; 3+ messages in thread
From: Shawn O. Pearce @ 2009-05-20 22:52 UTC (permalink / raw)
To: Stephen Boyd; +Cc: git
Stephen Boyd <bebarino@gmail.com> wrote:
> This seems to work most of the time.
>
> This
> git log --pretty=format:%ad:%<TAB>
> becomes
> git log --pretty=format:%ad:%ad:%
> which is wrong.
>
> But in quotes
> git log --pretty=format:"%ad:%<TAB>
> works.
>
> I'm not sure why.
bash oddity? Back when I started the completion I had a lot
of trouble with stuff like --pretty=<TAB>, or foo:<TAB> because
bash more often than not tried to second guess what I was doing.
I wonder if you are running against that here.
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index ad26b7c..3819c73 100755
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -1117,6 +1117,9 @@ __git_log_shortlog_options="
>
> __git_log_pretty_formats="oneline short medium full fuller email raw format:"
> __git_log_date_formats="relative iso8601 rfc2822 short local default raw"
> +__git_log_format_placeholders="ad aD ae aE ai an aN ar at b Cblue cd cD ce cE
> +Cgreen ci cn cN cr Cred Creset ct d e f h H m n p P s t T x
> +"
To be honest, I'm not sure what value this provides. Its just as
many characters to type, isn't it, and it doesn't offer me any help
as to which placeholder should be inserted to get the value I want.
"Was it ae or aE that I wanted here? WTF, manpage time!".
--
Shawn.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC/PATCH] completion: complete pretty format placeholders
2009-05-20 22:52 ` Shawn O. Pearce
@ 2009-05-21 3:59 ` Stephen Boyd
0 siblings, 0 replies; 3+ messages in thread
From: Stephen Boyd @ 2009-05-21 3:59 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: git
Shawn O. Pearce wrote:
> bash oddity? Back when I started the completion I had a lot
> of trouble with stuff like --pretty=<TAB>, or foo:<TAB> because
> bash more often than not tried to second guess what I was doing.
> I wonder if you are running against that here.
Thanks for the heads up.
> To be honest, I'm not sure what value this provides. Its just as
> many characters to type, isn't it, and it doesn't offer me any help
> as to which placeholder should be inserted to get the value I want.
> "Was it ae or aE that I wanted here? WTF, manpage time!".
Yeah, you're probably right. Throw it on the dust pile ;-)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-05-21 3:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-16 10:07 [RFC/PATCH] completion: complete pretty format placeholders Stephen Boyd
2009-05-20 22:52 ` Shawn O. Pearce
2009-05-21 3:59 ` Stephen Boyd
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).