fork/helix

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

Luca SaccarolaMake bash completion behave normally (#11246)ef4a4ff3

25.01
859 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        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        COMPREPLY=($(compgen -W """$languages""" -- "$cur"))
18        return 0
19        ;;
20    esac
21
22    case "$2" in
23    -*)
24        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        COMPREPLY=($(compgen -fd -- """$2"""))
29        return 0
30        ;;
31    esac
32} && complete -o filenames -F _hx hx