From 91ddee6bf045b1c6144d14233abdb96127186ec3 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sun, 10 May 2020 20:32:21 +0200 Subject: nix: Implement basic bash completion --- misc/bash/completion.sh | 7 +++++++ misc/bash/local.mk | 1 + 2 files changed, 8 insertions(+) create mode 100644 misc/bash/completion.sh create mode 100644 misc/bash/local.mk (limited to 'misc/bash') diff --git a/misc/bash/completion.sh b/misc/bash/completion.sh new file mode 100644 index 000000000..097353b50 --- /dev/null +++ b/misc/bash/completion.sh @@ -0,0 +1,7 @@ +function _complete_nix { + while IFS= read -r line; do + COMPREPLY+=("$line") + done < <(NIX_GET_COMPLETIONS=$COMP_CWORD "${COMP_WORDS[@]}") +} + +complete -F _complete_nix nix diff --git a/misc/bash/local.mk b/misc/bash/local.mk new file mode 100644 index 000000000..99ada5108 --- /dev/null +++ b/misc/bash/local.mk @@ -0,0 +1 @@ +$(eval $(call install-file-as, $(d)/completion.sh, $(datarootdir)/bash-completion/completions/_nix3, 0644)) -- cgit v1.2.3