Skip to content

Commit

Permalink
All input paths are now sanitized so hidden root directories can now be
Browse files Browse the repository at this point in the history
properly accessed.
  • Loading branch information
cryptolake committed Sep 2, 2021
1 parent 3b0f583 commit a99691a
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions tmuxcator
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
create-config()
{
# create config directory if not exist
if [ ! -d $cfdir ]; then
mkdir $cfdir
if [ ! -d "$cfdir" ]; then
mkdir "$cfdir"
fi
# standard template layout
template="
Expand All @@ -26,25 +26,25 @@ template="
windows=('python:gdb,main-vertical'.'zsh,main-vertical') \n
"
# create config file if non existant
if [ ! -f $cfile ]; then
touch $cfile
echo -e $template > $cfile
if [ ! -f "$cfile" ]; then
touch "$cfile"
echo -e "$template" > "$cfile"
fi
$EDITOR $cfile
"$EDITOR" "$cfile"
}

tmuxination()
{

#source the config file
source $cfile
source "$cfile"

#create project root if non existant
if [ -f $root ]; then
mkdir -pv $root
cd $root
if [ -f "$root" ]; then
mkdir -pv "$root"
cd "$root"
else
cd $root
cd "$root"
fi

#use . as seperator in bash arrays
Expand Down Expand Up @@ -101,36 +101,36 @@ cfdir="$XDG_CONFIG_HOME/tmuxcator"
case $1 in
new)
if [ ! -z "$2" -a "$2" != " " ]; then
cfile=$cfdir/$2
cfile="$cfdir"/"$2"
create-config
else
echo "check the <name> of the project"
fi
;;
list)
ls $cfdir
ls "$cfdir"
;;
edit)
if [ ! -z "$2" -a "$2" != " " ]; then
cfile=$cfdir/$2
$EDITOR $cfile
cfile="$cfdir"/"$2"
$EDITOR "$cfile"
else
echo "check the <name> of the project"
fi
;;
o)
if [ ! -z "$2" -a "$2" != " " ]; then
cfile=$cfdir/$2
cfile="$cfdir"/"$2"
tmuxination
else
echo "check the <name> of the project"
fi
;;
rm)
if [ ! -z "$2" -a "$2" != " " ]; then
cfile=$cfdir/$2
rm $cfile
echo "Deleted: " $cfile
cfile="$cfdir"/"$2"
rm "$cfile"
echo "Deleted: " "$cfile"
else
echo "check the <name> of the project"
fi
Expand Down

0 comments on commit a99691a

Please sign in to comment.