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