[PATCH v2 1/6] completion: support git-worktree
- From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
- Date
- May 22, 2016, 09:33 UTC
- Message-ID
- <20160522093356.22389-2-pclouds@gmail.com>
- In-Reply-To
- <20160522093356.22389-1-pclouds@gmail.com>
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> --- contrib/completion/git-completion.bash | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 3402475..951a186 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
-- 2.8.2.524.g6ff3d78