Skip to content

Commit b462c02

Browse files
pcloudsgitster
authored andcommitted
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>
1 parent 14ace5b commit b462c02

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

contrib/completion/git-completion.bash

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2595,6 +2595,29 @@ _git_whatchanged ()
25952595
_git_log
25962596
}
25972597

2598+
_git_worktree ()
2599+
{
2600+
local subcommands="add list prune"
2601+
local subcommand="$(__git_find_on_cmdline "$subcommands")"
2602+
if [ -z "$subcommand" ]; then
2603+
__gitcomp "$subcommands"
2604+
else
2605+
case "$subcommand,$cur" in
2606+
add,--*)
2607+
__gitcomp "--detach"
2608+
;;
2609+
list,--*)
2610+
__gitcomp "--porcelain"
2611+
;;
2612+
prune,--*)
2613+
__gitcomp "--dry-run --expire --verbose"
2614+
;;
2615+
*)
2616+
;;
2617+
esac
2618+
fi
2619+
}
2620+
25982621
__git_main ()
25992622
{
26002623
local i c=1 command __git_dir

0 commit comments

Comments
 (0)