From b6911b9e054bdf33ccfa7d053fa6a24cf6519d8d Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Sat, 28 Mar 2020 07:52:47 +1300 Subject: [PATCH 1/1] enable other commands to be passed --- .bin/mtmux | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.bin/mtmux b/.bin/mtmux index bee0bc8..0db35e1 100755 --- a/.bin/mtmux +++ b/.bin/mtmux @@ -29,6 +29,7 @@ err() { exit $exitcode } +cmds= for i in "$@"; do case "${state:-}:$i" in (:-c) state=cwd;; @@ -49,7 +50,10 @@ for i in "$@"; do state= ;; - (:--) shift; set -- "$@"; break + (:--) shift; set -- "$@"; break;; + + (:\;) cmds="$cmds \;";; + (:*) cmds="${cmds:+$cmds }$i";; esac shift 2>/dev/null || break done @@ -69,7 +73,7 @@ if [ -n "${window:-}" ]; then err 1 "Missing option -n, required with -w" fi - args="new -t $name \; select-window -t $window" + args="new -t $name \;${cmds:+ $cmds \;} select-window -t $window" else @@ -78,9 +82,10 @@ else case "$i" in (*:) wname="${i%:}";; (+|.|\;) - args="${args}${subcmd}${cwd:+ -c $cwd}${wname:+ -n $wname}${cmd:-} \\; " + args="${args}${subcmd}${cwd:+ -c $cwd}${wname:+ -n $wname}${cmd:-} \; " + args="$args${cmds:+$cmds \; }" subcmd="neww -d" - cmd= + cmd= cmds= ;; (*) cmd="${cmd:-} $i";; esac -- 2.39.5