on aef00a3 help sign in
23 lines 567 B history raw
1#!/usr/bin/env bash
2# Bash completion script for Helix editor
4_hx() {
5 # $1 command name
6 # $2 word being completed
7 # $3 word preceding
8 COMPREPLY=()
10 case "$3" in
11 -g | --grammar)
12 COMPREPLY=($(compgen -W "fetch build" -- $2))
13 ;;
14 --health)
15 local languages=$(hx --health |tail -n '+7' |awk '{print $1}' |sed 's/\x1b\[[0-9;]*m//g')
16 COMPREPLY=($(compgen -W "$languages" -- $2))
17 ;;
18 *)
19 COMPREPLY=($(compgen -fd -W "-h --help --tutor -V --version -v -vv -vvv --health -g --grammar --vsplit --hsplit -c --config" -- $2))
20 ;;
21 esac
22} && complete -F _hx hx