########################################################################
-# Merge both global and local charfiles
+# Merge global and local charfiles
CHARDIR=$HOME/.cache/charsel
if [[ ! -d $CHARDIR ]]
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
if [[ ! -f $CHARFILE ]]
then
echo "Please enter a valid charfile."
- charsel list
+ charsel -l
exit 1
fi
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 "*-------------------------*"