aboutsummaryrefslogtreecommitdiff
path: root/misc/bash
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-05-10 20:32:21 +0200
committerEelco Dolstra <edolstra@gmail.com>2020-05-10 20:32:21 +0200
commit91ddee6bf045b1c6144d14233abdb96127186ec3 (patch)
tree5c75576b453c177c3a43a422db1323cb7452b7f8 /misc/bash
parent14a3a62bfca6c572b9a415cfa80cdbd7ad4326b3 (diff)
nix: Implement basic bash completion
Diffstat (limited to 'misc/bash')
-rw-r--r--misc/bash/completion.sh7
-rw-r--r--misc/bash/local.mk1
2 files changed, 8 insertions, 0 deletions
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))