public
Last active

A command that scripts a tmux session

  • Download Gist
flask-boilerplate-tmux.bash
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
#!/bin/bash
 
function flask-boilerplate-tmux
{
# https://github.com/swaroopch/flask-boilerplate
BASE="$HOME/code/flask-boilerplate"
cd $BASE
 
tmux start-server
tmux new-session -d -s flaskboilerplate -n model
tmux new-window -t flaskboilerplate:2 -n controller
tmux new-window -t flaskboilerplate:3 -n view
tmux new-window -t flaskboilerplate:4 -n console
tmux new-window -t flaskboilerplate:5 -n tests
tmux new-window -t flaskboilerplate:6 -n git
 
tmux send-keys -t flaskboilerplate:1 "cd $BASE/flask_application; vim models.py" C-m
tmux send-keys -t flaskboilerplate:2 "cd $BASE/flask_application/controllers; ls" C-m
tmux send-keys -t flaskboilerplate:3 "cd $BASE/flask_application/templates; ls" C-m
tmux send-keys -t flaskboilerplate:4 "bpython -i play.py" C-m
tmux send-keys -t flaskboilerplate:5 "python tests.py" C-m
tmux send-keys -t flaskboilerplate:6 "git status" C-m
 
tmux select-window -t flaskboilerplate:1
tmux attach-session -t flaskboilerplate
}

looks interesting...
what does this do?
the resulting screenshot will be nice to see :)

Thank you! I never even noticed send-keys before.

Very nice. Note to others, if you have "set -g base-index 0" which I think is the default, the windows start at 0, not 1.

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.