aboutsummaryrefslogtreecommitdiff
path: root/contrib/completion/hx.bash
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/completion/hx.bash')
-rw-r--r--contrib/completion/hx.bash23
1 files changed, 23 insertions, 0 deletions
diff --git a/contrib/completion/hx.bash b/contrib/completion/hx.bash
new file mode 100644
index 00000000..6371bedb
--- /dev/null
+++ b/contrib/completion/hx.bash
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+# Bash completion script for Helix editor
+
+_hx() {
+ # $1 command name
+ # $2 word being completed
+ # $3 word preceding
+ COMPREPLY=()
+
+ case "$3" in
+ -g | --grammar)
+ COMPREPLY=($(compgen -W "fetch build" -- $2))
+ ;;
+ --health)
+ local languages=$(hx --health |tail -n '+7' |awk '{print $1}' |sed 's/\x1b\[[0-9;]*m//g')
+ COMPREPLY=($(compgen -W "$languages" -- $2))
+ ;;
+ *)
+ COMPREPLY=($(compgen -fd -W "-h --help --tutor -V --version -v -vv -vvv --health -g --grammar" -- $2))
+ ;;
+ esac
+} && complete -F _hx hx
+