########################################################################
-VERSION=2.0.2
+VERSION=2.0.3
# Define argument functions
function usage() {
-d show readme
-v print version
-c check charfile validity
- --all include hidden shortcodes
+ -a include hidden shortcodes
Exit status:
0 okay,
}
# Look for arguments
-while getopts ":lchdv" arg
+while getopts ":alchdv" arg
do
case ${arg} in
h)
validity
exit 0
;;
+ a)
+ SHOWALL="true"
+ ;;
?)
echo "Invalid option"
usage
exit 3
;;
- :)
- break
- ;;
esac
done
shift $((OPTIND-1))
clear
+# Define text formatting
+bold=$(tput bold)
+normal=$(tput sgr0)
+
# Main program
while true
do
# Format output
echo "*---------*---------------*"
- echo "| CHARSEL |" $1
+ echo "| ${bold}CHARSEL${normal} |" $1
echo "*---------*---------------*"
echo ""
- if [[ $2 == "--all" ]]
+ if [[ $SHOWALL == true ]]
then
cat $CHARFILE | sed -e '/^[ \t]*#/d' | tail -n +2 \
- | column -t -N input,output --output-separator ' | ' --separator ','
+ | 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 ','
+ | column -t -N "input","output" --output-separator ' | ' --separator ','
fi
echo ""
echo "*-------------------------*"
# User input
- read -p "| input shortcode: " -N $LENGTH INPUT
+ read -p "| ${bold}input shortcode: ${normal} " -N $LENGTH INPUT
if [[ $INPUT == ";"* ]] # Semicolon exits
then