Add start point to worktree add subcommand

This commit is contained in:
2026-10-20 11:37:54 +01:00
parent 538f90083b
commit e3d3d01998
2 changed files with 43 additions and 6 deletions

View File

@@ -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'