Skip to content

Commit

Permalink
Fix killing logic
Browse files Browse the repository at this point in the history
  • Loading branch information
ingara committed Apr 6, 2021
1 parent b1475cc commit 3ff1ac1
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions tmux-lazy-session
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
#!/usr/bin/env bash

SESSION_NAME="vscode`pwd | md5`"
KILL_SESSION=0

while getopts n:k flag
while getopts ":kn:" flag
do
case "${flag}" in
n) SESSION_NAME=${OPTARG};;
k) KILL_SESSION=1;;
case $flag in
n)
SESSION_NAME=${OPTARG}
;;
k)
KILL_SESSION=1
;;
esac
done

if [[ KILL_SESSION ]]; then
if [[ $KILL_SESSION -eq 1 ]]; then
tmux kill-session -t $SESSION_NAME
else
tmux attach-session -d -t $SESSION_NAME || tmux new-session -s $SESSION_NAME
Expand Down

0 comments on commit 3ff1ac1

Please sign in to comment.