]> git.armaanb.net Git - charsel.git/blobdiff - src/charsel
switched to using makefile, and ~/.cache instead of /tmp
[charsel.git] / src / charsel
index fe185a4676406434d3ec7d81f73d9a38ab92b72a..6713b599d56b097afc7931b652aa97c0a132f1eb 100755 (executable)
 
 #!/usr/bin/env sh
 # Merge both global and local charfiles
-CHARDIR=/tmp/charsel
+CHARDIR=~/.cache/charsel
+mkdir $CHARDIR/
 cp -R /usr/share/charsel/* $CHARDIR/
-cp -R ~/.local/share/* $CHARDIR/
-
-# Clear screen
-clear
+cp -R ~/.local/share/charsel/* $CHARDIR/
 
 # Check if user provided an input
-[ -z "$1" ] && echo "No argument supplied"  && exit
-
 if [ $1 = "list" ]; then
   echo "The following charfiles are installed"
   ls $CHARDIR/charfiles
   exit
+elif [[ $1 = "help" || $1 = "-h" || $1 = "--help" || $# -ne 1 ]]; then
+  cat /usr/share/doc/charsel/README.md
+  exit
 else
 
-# Define charfile
+# Clear screen
+clear
+
+# Define charfile path
 CHARFILE=$CHARDIR/charfiles/$1
 
 # Define length of shortcut
 LENGTH=$(cat $CHARFILE | cut -f 1 -d ',' -s | wc -L | cut -b 1)
 
 # MOTD
-cat /tmp/charsel/motd
+cat $CHARDIR/motd
 
 # Main program
 while :