X-Git-Url: https://git.armaanb.net/?p=charsel.git;a=blobdiff_plain;f=charsel;h=d2e7525e0c246a9b4a4a165d024e169ce22c9d74;hp=5ee8b80da8e0cf683a20cf04c60077c33068aa87;hb=76db80f5cf647e9aa47cd1404e7acd5107166dfb;hpb=964160e6b899f5074aec9a23faaf176df38bbbbd diff --git a/charsel b/charsel index 5ee8b80..d2e7525 100755 --- a/charsel +++ b/charsel @@ -19,7 +19,7 @@ ######################################################################## -# Merge both global and local charfiles +# Merge global and local charfiles CHARDIR=$HOME/.cache/charsel if [[ ! -d $CHARDIR ]] @@ -39,17 +39,19 @@ then fi # Check for user inputs -if [[ $1 == "list" \ - || $1 == "-l" \ +if [[ $1 == "-l" \ || $1 == "--list" ]] then echo "The following charfiles are installed:" ls $CHARDIR/charfiles exit 0 -elif [[ $1 == "help" \ - || $1 == "-h" \ - || $1 == "--help" \ - || $# -ne 1 ]] +elif [[ $1 == "-h" \ + || $1 == "--help" ]] +then + cat /usr/share/doc/charsel/usage + exit 0 +elif [[ $1 == "-d" \ + || $1 == "--doc" ]] then cat /usr/share/doc/charsel/README.md exit 0 @@ -62,7 +64,7 @@ CHARFILE=$CHARDIR/charfiles/$1 if [[ ! -f $CHARFILE ]] then echo "Please enter a valid charfile." - charsel list + charsel -l exit 1 fi @@ -83,11 +85,19 @@ do echo "*---------*---------------*" echo "" - cat $CHARFILE \ - | sed -e '/^[ \t]*#/d' \ - | grep -A 100 - \ - | tail -n +2 \ - | column -t -N input,output --output-separator ' | ' --separator ',' + if [[ $2 == "--all" ]] + then + cat $CHARFILE \ + | sed -e '/^[ \t]*#/d' \ + | tail -n +2 \ + | column -t -N input,output --output-separator ' | ' --separator ',' + else + cat $CHARFILE \ + | sed -e '/^[ \t]*#/d' \ + | grep -A 100 - \ + | tail -n +2 \ + | column -t -N input,output --output-separator ' | ' --separator ',' + fi echo "" echo "*-------------------------*"