X-Git-Url: https://git.madduck.net/etc/tmux.git/blobdiff_plain/1b3743469547cb3d91ae0d789df8714af7e96301..6e2532c9967c2b34896052d09339efb869bc6972:/.bin/mtmux?ds=inline diff --git a/.bin/mtmux b/.bin/mtmux index bee0bc8..0b85a48 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 @@ -61,7 +65,7 @@ if [ -n "${window:-}" ]; then warn "Both -w and -c don't make sense, ignoring -c" cwd= fi - if [ -n "$@" ]; then + if [ -n "$*" ]; then warn "Ignoring commands specified with -w" set -- fi @@ -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