>cp charfiles/* /usr/share/charsel/charfiles/
>mkdir /usr/share/doc/charsel
>cp README.md /usr/share/doc/charsel/
+>cp usage /usr/share/doc/charsel/
>cp ./charsel /usr/bin/
uninstall:
>cp charfiles/* /usr/share/charsel/charfiles/
>mkdir /usr/share/doc/charsel
>cp README.md /usr/share/doc/charsel/
+>cp usage /usr/share/doc/charsel/
>cp ./charsel /usr/bin/
It uses a plain-text file known as a "charfile" to define shortcuts to special characters that are easy to access on the keyboard.
## Installation
-Run `make install` as root to install
+Run `make install` as root to install
Run `make uninstall` as root to remove. Will not delete your personal charfiles
## Dependencies
* Bash
- * Linux
- * Xclip
- * A terminal with UTF-8 encoding enabled
+ * Linux
+ * Xclip
+ * A terminal with UTF-8 encoding enabled
## Usage
-To start the program, run `charsel <charfile>`, this will start the program with the specified charfile. There are a few installed by default, to see them, use `charsel list`.
+For usage, use `charsel --help`
-Once you have started the program, simply type the shortcut listed on the left side of the table to copy the character on the right side of the table to your clipboard. Shortcodes the same length as the longest one will automatically be entered.
+Once you have started the program, simply type the shortcut listed on the left side of the table to copy the character on the right side of the table to your clipboard. Shortcodes the same length as the longest one will automatically be entered. To quit, use ^C
Some of the default charfiles have hidden shortcuts for capital letters that are not shown on the table. Simply type a capital version of the shortcut key to access the capital version of the special character.
## License
Charfile is GNU GPLv3 licensed, see COPYING for more information
-
+
Charfile is written by [Armaan Bhojwani](https://armaan.bhojwani.org), [Email](mailto:3fb650a9-b47e-4604-a282-1dd91953b2ee@anonaddy.me)
########################################################################
-# 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 "*-------------------------*"
--- /dev/null
+Usage: /usr/bin/charsel [OPTION]... [CHARFILE]...
+A simple terminal charachter selector
+ -h, --help show this message
+ -l, --list show installed charfiles
+ -d, --doc show readme
+ --all include hidden shortcodes
+
+Exit status:
+ 0 if OK,
+ 1 if error