]> git.armaanb.net Git - charsel.git/commitdiff
properly added shell completions
authorArmaan Bhojwani <3fb650a9-b47e-4604-a282-1dd91953b2ee@anonaddy.me>
Mon, 26 Oct 2020 15:13:54 +0000 (11:13 -0400)
committerArmaan Bhojwani <3fb650a9-b47e-4604-a282-1dd91953b2ee@anonaddy.me>
Mon, 26 Oct 2020 15:13:54 +0000 (11:13 -0400)
Makefile
README.md
bash-completions [deleted file]
shell-completions [new file with mode: 0755]

index 1ed3a853e83c7953b31dff7979561005f27f3838..d8407fe7fcaacd3cf43210bf43ca877cdd0d597c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -5,6 +5,7 @@ install:
 >chmod +x ./charsel
 >mkdir -p /usr/share/charsel/charfiles/
 >cp charfiles/* /usr/share/charsel/charfiles/
 >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/
 >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/
 >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/
 >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/
 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'
index a9f84b8d852463c1682164e9046f61d939de3df9..a3705005485140acc0c9c531e46c9d1789e65a22 100644 (file)
--- 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`
 
 ## 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.
 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
 
 
 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
 
 ## License
 Charfile is GNU GPLv3 licensed, see COPYING for more information
 
diff --git a/bash-completions b/bash-completions
deleted file mode 100755 (executable)
index 375d8eb..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-_script()
-{
-  _script_commands=$(charsel -L)
-
-  local cur prev
-  COMPREPLY=()
-  cur="${COMP_WORDS[COMP_CWORD]}"
-  COMPREPLY=( $(compgen -W "${_script_commands}" -- ${cur}) )
-
-  return 0
-}
-complete -o nospace -F _script charsel
diff --git a/shell-completions b/shell-completions
new file mode 100755 (executable)
index 0000000..172eb4b
--- /dev/null
@@ -0,0 +1,12 @@
+charfiles()
+{
+  _script_commands=$(charsel -L)
+
+  local cur prev
+  COMPREPLY=()
+  cur="${COMP_WORDS[COMP_CWORD]}"
+  COMPREPLY=( $(compgen -W "${_script_commands}" -- ${cur}) )
+
+  return 0
+}
+complete -o nospace -F charfiles charsel