]> git.armaanb.net Git - charsel.git/commitdiff
changed -a behavior, text formatting
authorArmaan Bhojwani <3fb650a9-b47e-4604-a282-1dd91953b2ee@anonaddy.me>
Sun, 18 Oct 2020 16:25:08 +0000 (12:25 -0400)
committerArmaan Bhojwani <3fb650a9-b47e-4604-a282-1dd91953b2ee@anonaddy.me>
Sun, 18 Oct 2020 16:25:08 +0000 (12:25 -0400)
charsel

diff --git a/charsel b/charsel
index 170a386b5e5d6860de592cda79e36977448fc298..9915519b760131eabca6169189c6dc35dd204e27 100755 (executable)
--- a/charsel
+++ b/charsel
@@ -19,7 +19,7 @@
 
 ########################################################################
 
-VERSION=2.0.2
+VERSION=2.0.3
 
 # Define argument functions
 function usage() {
@@ -30,7 +30,7 @@ A simple terminal character selector
   -d              show readme
   -v              print version
   -c              check charfile validity
-      --all       include hidden shortcodes
+  -a              include hidden shortcodes
 
 Exit status:
   0    okay,
@@ -104,7 +104,7 @@ function validity() {
 }
 
 # Look for arguments
-while getopts ":lchdv" arg
+while getopts ":alchdv" arg
 do
   case ${arg} in
     h)
@@ -127,14 +127,14 @@ do
       validity
       exit 0
       ;;
+    a)
+      SHOWALL="true"
+      ;;
     ?)
       echo "Invalid option"
       usage
       exit 3
       ;;
-    :)
-      break
-      ;;
   esac
 done
 shift $((OPTIND-1))
@@ -159,22 +159,26 @@ LENGTH=$(cat $CHARFILE \
 
 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 ""
@@ -184,7 +188,7 @@ do
   echo "*-------------------------*"
 
   # User input
-  read -p "| input shortcode:   " -N $LENGTH INPUT
+  read -p "| ${bold}input shortcode: ${normal}  " -N $LENGTH INPUT
 
   if [[ $INPUT == ";"* ]] # Semicolon exits
   then