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>
Nguyễn Thái Ngọc Duy committed
May 22, 2016 at 16:33 UTC
b462c024022e3a41821f24bca9e43f16973693db
1 file changed
+23
contrib/completion/git-completion.bash
+23
@@ -2595,6 +2595,29 @@ _git_whatchanged ()
2595
_git_log
2596
}
2597
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
+
2621
__git_main ()
2622
{
2623
local i c=1 command __git_dir