fork/helix

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

Xubai WangFix Bash completion space regression (#12828)ff012e84

25.07.1
903 B32 linesraw
1#!/usr/bin/env bash
2# Bash completion script for Helix editor
3
4_hx() {
5    local cur prev languages
6    COMPREPLY=()
7    cur="${COMP_WORDS[COMP_CWORD]}"
8    prev="${COMP_WORDS[COMP_CWORD - 1]}"
9
10    case "$prev" in
11    -g | --grammar)
12        mapfile -t COMPREPLY < <(compgen -W 'fetch build' -- "$cur")
13        return 0
14        ;;
15    --health)
16        languages=$(hx --health | tail -n '+7' | awk '{print $1}' | sed 's/\x1b\[[0-9;]*m//g')
17        mapfile -t COMPREPLY < <(compgen -W """$languages""" -- "$cur")
18        return 0
19        ;;
20    esac
21
22    case "$2" in
23    -*)
24        mapfile -t COMPREPLY < <(compgen -W "-h --help --tutor -V --version -v -vv -vvv --health -g --grammar --vsplit --hsplit -c --config --log" -- """$2""")
25        return 0
26        ;;
27    *)
28        mapfile -t COMPREPLY < <(compgen -fd -- """$2""")
29        return 0
30        ;;
31    esac
32} && complete -o filenames -F _hx hx