From 3175a81c8c551bb01af2dbc2737718dbb3ab0090 Mon Sep 17 00:00:00 2001 From: Armaan Bhojwani <3fb650a9-b47e-4604-a282-1dd91953b2ee@anonaddy.me> Date: Mon, 26 Oct 2020 11:13:54 -0400 Subject: [PATCH] properly added shell completions --- Makefile | 6 ++++++ README.md | 5 +++-- bash-completions => shell-completions | 4 ++-- 3 files changed, 11 insertions(+), 4 deletions(-) rename bash-completions => shell-completions (77%) diff --git a/Makefile b/Makefile index 1ed3a85..d8407fe 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ install: >chmod +x ./charsel >mkdir -p /usr/share/charsel/charfiles/ >cp charfiles/* /usr/share/charsel/charfiles/ +>cp shell-completions /usr/share/charsel/ >mkdir /usr/share/doc/charsel >cp README.md /usr/share/doc/charsel/ >cp ./charsel /usr/bin/ @@ -21,6 +22,7 @@ reinstall: >chmod +x ./charsel >mkdir -p /usr/share/charsel/charfiles/ >cp charfiles/* /usr/share/charsel/charfiles/ +>cp shell-completions /usr/share/charsel/ >mkdir /usr/share/doc/charsel >cp README.md /usr/share/doc/charsel/ >cp ./charsel /usr/bin/ @@ -28,3 +30,7 @@ reinstall: purge: >rm -rf $USER/.local/share/charsel/ >rm -rf $USER/.cache/charsel/ + +install-completions-bash: +>echo "source /usr/share/charsel/shell-completions" >> '${HOME}/.bashrc' +>echo "autoload bashcompinit ; bashcompinit ; source /usr/share/charsel/shell-completions" >> '${ZDOTDIR}/.zshrc' diff --git a/README.md b/README.md index a9f84b8..a370500 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,6 @@ It uses a plain-text file known as a "charfile" to define easy to reach shortcut ## Usage For argument usage, use `charsel -h` -This script is also so simple that the script itself can basically function as the documentation - Once you [have](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, type ';' as a shortcode 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. @@ -28,6 +26,9 @@ Make a new file in the `~/.local/share/charsel/charfiles/` or `/usr/share/charse Fill it in, using the provided examples as a template. Hidden shortcuts go above the '-', lines can be commented out using a '#' at the start of the line. ';' cannot be used as a shortcode, as that is used to quit the program +## Shell completions +There is a shell completion script provided. To install it, use `make install-completions` + ## License Charfile is GNU GPLv3 licensed, see COPYING for more information diff --git a/bash-completions b/shell-completions similarity index 77% rename from bash-completions rename to shell-completions index 375d8eb..172eb4b 100755 --- a/bash-completions +++ b/shell-completions @@ -1,4 +1,4 @@ -_script() +charfiles() { _script_commands=$(charsel -L) @@ -9,4 +9,4 @@ _script() return 0 } -complete -o nospace -F _script charsel +complete -o nospace -F charfiles charsel -- 2.39.2