3 # Merge both global and local charfiles
4 CHARDIR=~/.cache/charsel
9 elif [[ ! "$(ls -A $CHARDIR)" ]]
11 cp -rf /usr/share/charsel/- $CHARDIR/
12 cp -rf $HOME/.local/share/charsel/- $CHARDIR/
15 # Check for user inputs
20 echo "The following charfiles are installed"
23 elif [[ $1 == "help" \
28 cat /usr/share/doc/charsel/README.md
32 # Define charfile path
33 CHARFILE=$CHARDIR/charfiles/$1
35 if [[ ! -f $CHARFILE ]]
37 echo "Please enter a valid charfile. You can list installed charfiles with \`charsel list\`"
41 # Define length of shortcut
42 LENGTH=$(cat $CHARFILE \
43 | cut -f 1 -d ',' -s \
54 echo "*---------*---------------*"
55 echo "| CHARSEL | " $1
56 echo "*---------*---------------*"
60 | sed -e '/^[ \t]*#/d' \
63 | column -t -N input,output --output-separator ' | ' --separator ','
66 echo "*-------------------------*"
67 echo "| previous shorcode:" $INPUT
68 echo "| previous output: " $OUTPUT
69 echo "*-------------------------*"
72 read -p "| input shortcode: " -N $LENGTH INPUT
74 # This can definately be simplifed, but it works fine
75 LINENUMBER=$(cut -f 1 -d ',' -s $CHARFILE \
78 OUTPUT=$(cut -f 2 -d ',' -s $CHARFILE \
82 # Copy output to clipboard
83 echo $OUTPUT | xclip -selection clipboard