From: martin f. krafft Date: Fri, 27 Mar 2020 18:52:47 +0000 (+1300) Subject: enable other commands to be passed X-Git-Url: https://git.madduck.net/etc/tmux.git/commitdiff_plain/b6911b9e054bdf33ccfa7d053fa6a24cf6519d8d?ds=sidebyside;hp=1b3743469547cb3d91ae0d789df8714af7e96301 enable other commands to be passed --- 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