diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2021-09-15 20:33:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-15 20:33:44 +0200 |
commit | 79152e307e7eef667c3de9c21571d017654a7c32 (patch) | |
tree | 67fd413bcf0b42c5ada7eddc41a04f7bd99df3a8 /misc/bash/completion.sh | |
parent | 7349f257da8278af9aae35544b15c9a204e2a57b (diff) | |
parent | 3b82c1a5fef521ebadea5df12384390c8c24100c (diff) |
Merge pull request #5212 from mkenigs/auto-uid-allocation
Merge master into #3600
Diffstat (limited to 'misc/bash/completion.sh')
-rw-r--r-- | misc/bash/completion.sh | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/misc/bash/completion.sh b/misc/bash/completion.sh new file mode 100644 index 000000000..bea2a40bc --- /dev/null +++ b/misc/bash/completion.sh @@ -0,0 +1,20 @@ +function _complete_nix { + local -a words + local cword cur + _get_comp_words_by_ref -n ':=&' words cword cur + local have_type + while IFS= read -r line; do + local completion=${line%% *} + if [[ -z $have_type ]]; then + have_type=1 + if [[ $completion = filenames ]]; then + compopt -o filenames + fi + else + COMPREPLY+=("$completion") + fi + done < <(NIX_GET_COMPLETIONS=$cword "${words[@]}") + __ltrim_colon_completions "$cur" +} + +complete -F _complete_nix nix |