2022-04-12 12:10:21 +04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# Bash completion script for Helix editor
|
|
|
|
|
|
|
|
_hx() {
|
|
|
|
# $1 command name
|
|
|
|
# $2 word being completed
|
|
|
|
# $3 word preceding
|
|
|
|
|
|
|
|
case "$3" in
|
|
|
|
-g | --grammar)
|
2024-02-23 19:46:41 +04:00
|
|
|
COMPREPLY="$(compgen -W "fetch build" -- $2)"
|
2022-04-12 12:10:21 +04:00
|
|
|
;;
|
|
|
|
--health)
|
|
|
|
local languages=$(hx --health |tail -n '+7' |awk '{print $1}' |sed 's/\x1b\[[0-9;]*m//g')
|
2024-02-23 19:46:41 +04:00
|
|
|
COMPREPLY="$(compgen -W "$languages" -- $2)"
|
2022-04-12 12:10:21 +04:00
|
|
|
;;
|
|
|
|
*)
|
2024-02-23 19:46:41 +04:00
|
|
|
COMPREPLY="$(compgen -fd -W "-h --help --tutor -V --version -v -vv -vvv --health -g --grammar --vsplit --hsplit -c --config --log" -- $2)"
|
2022-04-12 12:10:21 +04:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2024-02-23 19:46:41 +04:00
|
|
|
local IFS=$'\n'
|
|
|
|
COMPREPLY=($COMPREPLY)
|
|
|
|
} && complete -o filenames -F _hx hx
|