Add session -p <project> flag
This flag sets the session name to `<project>` where `<project>` is a git repository to make working with multiple worktrees more streamlined.
This commit is contained in:
@@ -4,6 +4,8 @@ __session_sessions() {
|
||||
list() {
|
||||
for item in $HOME/.local/share/tmux/layouts/session-*; do
|
||||
item=${item#$HOME/.local/share/tmux/layouts/}
|
||||
# session-project is parameterized by -p, not a session of its own
|
||||
[ "$item" = session-project ] && continue
|
||||
echo ${item#session-}
|
||||
done
|
||||
}
|
||||
@@ -12,6 +14,10 @@ __session_sessions() {
|
||||
_describe 'session' sessions
|
||||
}
|
||||
|
||||
__session_projects() {
|
||||
_files -W $HOME/Projects -/
|
||||
}
|
||||
|
||||
__session_hosts() {
|
||||
list() {
|
||||
declare -A hosts
|
||||
@@ -28,5 +34,7 @@ __session_hosts() {
|
||||
}
|
||||
|
||||
_arguments \
|
||||
'(- *)'{-h,--help}'[Show usage information]' \
|
||||
'(- *)'{-p,--project}'[Create or attach to a session for a project in ~/Projects]:project:__session_projects' \
|
||||
':session:__session_sessions' \
|
||||
':host:__session_hosts'
|
||||
|
||||
Reference in New Issue
Block a user