fork/helix

git clone https://git.julia.blue/fork/helix

wr7Completely fix bash autocomplete handling of filenames with spaces (#9708)38484f33

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