1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-06-10 05:16:15 +02:00

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>
This commit is contained in:
Nguyễn Thái Ngọc Duy 2016-05-22 16:33:51 +07:00 committed by Junio C Hamano
parent 14ace5b77b
commit b462c02402

View File

@ -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