Add start point to worktree add subcommand
This commit is contained in:
@@ -9,6 +9,14 @@ __worktree_branches() {
|
||||
_describe 'branch' branches
|
||||
}
|
||||
|
||||
__worktree_start_points() {
|
||||
local -a refs
|
||||
refs=(
|
||||
${(fo)"$(git for-each-ref --format='%(refname:short)' refs/heads refs/remotes 2>/dev/null)"}
|
||||
)
|
||||
_describe 'start point' refs
|
||||
}
|
||||
|
||||
__worktree_active_branches() {
|
||||
local -a branches
|
||||
branches=(${(fo)"$(git worktree list --porcelain 2>/dev/null | \
|
||||
@@ -49,7 +57,9 @@ _worktree() {
|
||||
curcontext="${curcontext%:*:*}:worktree-cmd-$words[1]:"
|
||||
case $line[1] in
|
||||
(add)
|
||||
_arguments '1:: :__worktree_branches'
|
||||
_arguments \
|
||||
'1:: :__worktree_branches' \
|
||||
'2:: :__worktree_start_points'
|
||||
;;
|
||||
(cd)
|
||||
_arguments '1:: :__worktree_all_branches'
|
||||
|
||||
Reference in New Issue
Block a user