diff options
Diffstat (limited to 'tests/tmux-util/fake-tmux')
| -rwxr-xr-x | tests/tmux-util/fake-tmux | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/tmux-util/fake-tmux b/tests/tmux-util/fake-tmux index ba2d5cc..163ea24 100755 --- a/tests/tmux-util/fake-tmux +++ b/tests/tmux-util/fake-tmux @@ -97,6 +97,8 @@ case "$cmd" in *) shift ;; esac done + # tmux accepts a `=name` form to force exact match; strip the prefix. + session="${session#=}" while IFS=' ' read -r name attached pids _rest; do if [ "$name" = "$session" ]; then exit 0 @@ -104,6 +106,25 @@ case "$cmd" in done < "$STATE" exit 1 ;; + new-session) + detached=0 + name="" + cwd="" + while [ "$#" -gt 0 ]; do + case "$1" in + -s) shift; name="$1"; shift ;; + -c) shift; cwd="$1"; shift ;; + -d) detached=1; shift ;; + *) shift ;; + esac + done + attached=1 + [ "$detached" -eq 1 ] && attached=0 + printf '%s %s - 0 1 %s\n' "$name" "$attached" "${cwd:-/tmp}" >> "$STATE" + ;; + attach-session|switch-client) + # No state mutation needed — the call log already records intent. + ;; kill-session) session="" while [ "$#" -gt 0 ]; do |
