Add some new lines to worktree.plugin.zsh

This commit is contained in:
2026-05-21 14:52:04 +01:00
parent c63b9cceb4
commit 83b24c67d1

View File

@@ -45,6 +45,7 @@ Manage git worktrees by branch name."
_autoenv_authorized $wt_dest/.exit yes
fi
;;
cd)
if [[ -z "$branch" ]]; then
print -P "%F{red}error:%f missing <branch> argument"
@@ -59,6 +60,7 @@ Manage git worktrees by branch name."
fi
cd "$wt_path"
;;
list|ls)
local root=$(git rev-parse --show-toplevel)
local prefix="${root:h}/${root:t}@"
@@ -67,6 +69,7 @@ Manage git worktrees by branch name."
/^branch refs\/heads\//{ if(index(p, prefix)==1) { sub(/^branch refs\/heads\//, ""); print } }
'
;;
rm|remove)
local force=0
local branches=()
@@ -129,6 +132,7 @@ Manage git worktrees by branch name."
done
return $failed
;;
sync)
local root=$(git rev-parse --show-toplevel)
local prefix="${root:h}/${root:t}@"
@@ -169,6 +173,7 @@ Manage git worktrees by branch name."
done
return $failed
;;
*)
print -P "%F{red}error:%f unknown command: $cmd"
return 1