Re: [PATCH 1/7] completion: support git-worktree
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- May 11, 2016, 06:12 UTC
- Message-ID
- <CAPig+cQYbMq08_HuKqC6rwhEZjN+1E8YBk1775k9Xgi+GJ_SRw@mail.gmail.com>
- In-Reply-To
- <20160510141553.22967-1-pclouds@gmail.com>
On Tue, May 10, 2016 at 10:15 AM, Nguyễn Thái Ngọc Duy <pclouds@gmail.com> wrote:
> completion: support git-worktree
See [1] and, especially, [2] for previous attempts...
[1]: http://thread.gmane.org/gmane.comp.version-control.git/274526 [2]: http://thread.gmane.org/gmane.comp.version-control.git/274526/focus=276333
Show 38 quoted lines
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 3402475..d3ac391 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 --force"
> + ;;
> + 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