Skip to content

Instantly share code, notes, and snippets.

@mynameisfiber
Created November 5, 2018 00:31
Show Gist options
  • Save mynameisfiber/85e9d5471317075bbb8109bc0e68d53b to your computer and use it in GitHub Desktop.
Save mynameisfiber/85e9d5471317075bbb8109bc0e68d53b to your computer and use it in GitHub Desktop.
Launch slack-term for multiple teans in a tmux session
#!/bin/bash
_TMUX_NAME="slackterm"
function _startSlack() {
i=0
for config in $( ls ~/.slack-term/*.json ); do
if [[ "$i" -eq "0" ]]; then
TMUX="tmux new-session -d -s ${_TMUX_NAME}"
else
TMUX="tmux new-window -P -t ${_TMUX_NAME}:$i"
fi
i=$(( $i + 1 ))
name=$( basename $config | cut -d. -f1 )
${TMUX} -n $name "while true; do slack-term -config ${config}; done;"
done
tmux select-window -t ${_TMUX_NAME}:0
tmux attach-session -t ${_TMUX_NAME}
}
echo "Updating slack"
go get -u github.com/erroneousboat/slack-term
if tmux has-session -t ${_TMUX_NAME}; then
echo "attaching"
tmux a -t ${_TMUX_NAME}
else
echo "starting new"
_startSlack
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment