From: "Shawn O. Pearce" <spearce@spearce.org>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: [PATCH 8/10] Teach bash about git log/show/whatchanged options.
Date: Mon, 27 Nov 2006 03:42:18 -0500 [thread overview]
Message-ID: <20061127084218.GH19745@spearce.org> (raw)
In-Reply-To: <de7beb117fb963e68e1085b773593be326ffd495.1164616814.git.spearce@spearce.org>
Typing out options to git log/show/whatchanged can take a while, but
we can easily complete them with bash. So list the most common ones,
especially --pretty=online|short|medium|... so that users don't need
to type everything out.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
contrib/completion/git-completion.bash | 34 ++++++++++++++++++++++++-------
1 files changed, 26 insertions(+), 8 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index a61b6b9..8acfb09 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -358,6 +358,29 @@ _git_ls_tree ()
_git_log ()
{
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+ case "$cur" in
+ --pretty=*)
+ COMPREPLY=($(compgen -W "
+ oneline short medium full fuller email raw
+ " -- "${cur##--pretty=}"))
+ return
+ ;;
+ --*)
+ COMPREPLY=($(compgen -W "
+ --max-count= --max-age= --since= --after=
+ --min-age= --before= --until=
+ --root --not --topo-order --date-order
+ --no-merges
+ --abbrev-commit --abbrev=
+ --relative-date
+ --author= --committer= --grep=
+ --all-match
+ --pretty= --name-status --name-only
+ " -- "$cur"))
+ return
+ ;;
+ esac
__git_complete_revlist
}
@@ -474,12 +497,6 @@ _git_reset ()
COMPREPLY=($(compgen -W "$opt $(__git_refs)" -- "$cur"))
}
-_git_show ()
-{
- local cur="${COMP_WORDS[COMP_CWORD]}"
- COMPREPLY=($(compgen -W "$(__git_refs)" -- "$cur"))
-}
-
_git ()
{
local i c=1 command __git_dir
@@ -526,7 +543,7 @@ _git ()
push) _git_push ;;
rebase) _git_rebase ;;
reset) _git_reset ;;
- show) _git_show ;;
+ show) _git_log ;;
show-branch) _git_log ;;
whatchanged) _git_log ;;
*) COMPREPLY=() ;;
@@ -559,7 +576,7 @@ complete -o default -o nospace -F _git_pull git-pull
complete -o default -o nospace -F _git_push git-push
complete -o default -F _git_rebase git-rebase
complete -o default -F _git_reset git-reset
-complete -o default -F _git_show git-show
+complete -o default -F _git_log git-show
complete -o default -o nospace -F _git_log git-show-branch
complete -o default -o nospace -F _git_log git-whatchanged
@@ -579,6 +596,7 @@ complete -o default -o nospace -F _git_ls_tree git-ls-tree.exe
complete -o default -F _git_merge_base git-merge-base.exe
complete -o default -F _git_name_rev git-name-rev.exe
complete -o default -o nospace -F _git_push git-push.exe
+complete -o default -o nospace -F _git_log git-show.exe
complete -o default -o nospace -F _git_log git-show-branch.exe
complete -o default -o nospace -F _git_log git-whatchanged.exe
fi
--
1.4.4.1.ge3fb
next prev parent reply other threads:[~2006-11-27 8:42 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <de7beb117fb963e68e1085b773593be326ffd495.1164616814.git.spearce@spearce.org>
2006-11-27 8:41 ` [PATCH 2/10] Hide plumbing/transport commands from bash completion Shawn O. Pearce
2006-11-27 8:41 ` [PATCH 3/10] Teach bash how to complete options for git-name-rev Shawn O. Pearce
2006-11-27 8:41 ` [PATCH 4/10] Add current branch in PS1 support to git-completion.bash Shawn O. Pearce
2006-11-27 15:31 ` Sean
[not found] ` <20061127103111.4835bffc.seanlkml@sympatico.ca>
2006-11-27 16:51 ` Shawn Pearce
2006-11-27 17:26 ` Sean
[not found] ` <20061127122653.3e801d7a.seanlkml@sympatico.ca>
2006-11-27 17:31 ` Shawn Pearce
2006-11-27 17:45 ` Sean
2006-11-27 8:41 ` [PATCH 5/10] Teach bash how to complete git-format-patch Shawn O. Pearce
2006-11-27 8:50 ` Jakub Narebski
2006-11-27 8:41 ` [PATCH 6/10] Teach bash how to complete git-cherry-pick Shawn O. Pearce
2006-11-27 8:42 ` [PATCH 7/10] Teach bash how to complete git-rebase Shawn O. Pearce
2006-11-27 8:42 ` Shawn O. Pearce [this message]
2006-11-27 8:42 ` [PATCH 9/10] Allow completion of --committer and --author arguments to git log Shawn O. Pearce
2006-11-27 10:28 ` Nicolas Vilz
2006-11-27 16:46 ` Shawn Pearce
2006-11-27 20:20 ` Junio C Hamano
2006-11-27 20:49 ` Shawn Pearce
2006-11-27 8:42 ` [PATCH 10/10] Support bash completion of refs/remote Shawn O. Pearce
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=20061127084218.GH19745@spearce.org \
--to=spearce@spearce.org \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/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).