Skip to content

Commit

Permalink
Look under ~/.tmux/ for the file arg. Fixes #5.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesottaway committed Aug 8, 2015
1 parent 2d0915a commit 41baf89
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tmux-up
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,19 @@ then
fi

TMUX_DIR='.tmux'
GLOBAL_DIR="$HOME/$TMUX_DIR"
BASE=$(basename "$PWD" | sed 's/[^a-zA-Z0-9\-]//g')

if [ -f "$1" ]
then
FILE=$1
elif [ -f "$TMUX_DIR/$1" ]
then
FILE=$TMUX_DIR/$1
elif [ -f "$GLOBAL_DIR/$1" ]
then
FILE="$GLOBAL_DIR/$1"
unset BASE
elif [ -f 'tmux.conf' ]
then
FILE='tmux.conf'
Expand All @@ -57,10 +63,12 @@ else
exit 1
fi

BASE=$(basename "$PWD" | sed 's/[^a-zA-Z0-9\-]//g')
NAME=$(basename "$FILE" .conf)

if [ "$NAME" = 'tmux' ] || [ "$NAME" = '.tmux' ]
if [ -z "$BASE" ]
then
SESSION=$NAME
elif [ "$NAME" = 'tmux' ] || [ "$NAME" = '.tmux' ]
then
SESSION=$BASE
else
Expand Down

0 comments on commit 41baf89

Please sign in to comment.