diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2016-05-22 16:33:51 +0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-05-24 13:19:21 -0700 |
commit | b462c024022e3a41821f24bca9e43f16973693db (patch) | |
tree | 4fce46145b550efe9c6c028f0cf6551e8e28df47 /contrib | |
parent | 14ace5b77b493506a1f8ffde96a2f49cc7bc4db0 (diff) | |
download | git-b462c024022e3a41821f24bca9e43f16973693db.tar.gz |
completion: support git-worktree
This adds bare-bone completion support for git-worktree. More advanced
completion (e.g. ref completion in git-worktree-add) can be added later.
--force completion in "worktree add" is left out because that option
should be handled with care.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/completion/git-completion.bash | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 34024754d9..951a186df0 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -2595,6 +2595,29 @@ _git_whatchanged () _git_log } +_git_worktree () +{ + local subcommands="add list prune" + local subcommand="$(__git_find_on_cmdline "$subcommands")" + if [ -z "$subcommand" ]; then + __gitcomp "$subcommands" + else + case "$subcommand,$cur" in + add,--*) + __gitcomp "--detach" + ;; + list,--*) + __gitcomp "--porcelain" + ;; + prune,--*) + __gitcomp "--dry-run --expire --verbose" + ;; + *) + ;; + esac + fi +} + __git_main () { local i c=1 command __git_dir |