automatically open new docker container logs in a new pane of iTerm2
It's not perfect but it works, and well enough for 128
Just pop the file wherever, make it executable, and run it you may need to change the docker path at the top
./dockerpaner.jxa
this assumes that iTerm2 is installed and running on a mac (10.10+? maybe lower maybe higher).
the script accepts two arguments, -c and -k. you cant do -ck. just -c and or -k.
-c : a window is opened at the start of the script that we can split from. -c closes this pane once it is split off of
-k : by default the docker logs command is run directly, bypassing the shell. this command lets the shell open and then writes and runs the docker logs command, so that if a container crashes the pane does not close.
check for new containers every 3 seconds
split the rightmost panes from top to bottom inserting the new docker logs command
panes are split horizontally until there are 3 or 4 horizontal panes open, and then they're split vertically.
the script will continue to work if one of the original panes is still open, but if you close the whole window it will crash. you can just restart it.