aboutsummaryrefslogtreecommitdiff
path: root/completions
diff options
context:
space:
mode:
Diffstat (limited to 'completions')
-rw-r--r--completions/recit.bash14
-rw-r--r--completions/recit.zsh19
2 files changed, 33 insertions, 0 deletions
diff --git a/completions/recit.bash b/completions/recit.bash
new file mode 100644
index 0000000..76ab736
--- /dev/null
+++ b/completions/recit.bash
@@ -0,0 +1,14 @@
+_recit() {
+ COMPREPLY=()
+ local word="${COMP_WORDS[COMP_CWORD]}"
+
+ if [ "$COMP_CWORD" -eq 1 ]; then
+ COMPREPLY=( $(compgen -W "$(recit commands)" -- "$word") )
+ else
+ local command="${COMP_WORDS[1]}"
+ local completions="$(recit completions "$command")"
+ COMPREPLY=( $(compgen -W "$completions" -- "$word") )
+ fi
+}
+
+complete -F _recit recit
diff --git a/completions/recit.zsh b/completions/recit.zsh
new file mode 100644
index 0000000..db7a043
--- /dev/null
+++ b/completions/recit.zsh
@@ -0,0 +1,19 @@
+if [[ ! -o interactive ]]; then
+ return
+fi
+
+compctl -K _recit recit
+
+_recit() {
+ local word words completions
+ read -cA words
+ word="${words[2]}"
+
+ if [ "${#words}" -eq 2 ]; then
+ completions="$(recit commands)"
+ else
+ completions="$(recit completions "${word}")"
+ fi
+
+ reply=("${(ps:\n:)completions}")
+}