aboutsummaryrefslogtreecommitdiffgithub
path: root/bash_completion
diff options
context:
space:
mode:
authorAustin Adams <git@austinjadams.com>2015-09-12 18:19:58 -0400
committerAustin Adams <git@austinjadams.com>2015-09-12 18:19:58 -0400
commita197cbce85fc23383ea94c5245df7a5147492617 (patch)
tree87753b66c3266dfda102d031fbb15da8612248a7 /bash_completion
parentde522bea76293ac3ad149ef2e0dd6a70fbaa2e04 (diff)
downloadnsdo-a197cbce85fc23383ea94c5245df7a5147492617.tar.gz
nsdo-a197cbce85fc23383ea94c5245df7a5147492617.tar.xz
add bash completion, tweak makefile
also fixed a type in the manpage
Diffstat (limited to 'bash_completion')
-rw-r--r--bash_completion/nsdo20
1 files changed, 20 insertions, 0 deletions
diff --git a/bash_completion/nsdo b/bash_completion/nsdo
new file mode 100644
index 0000000..c3e32f1
--- /dev/null
+++ b/bash_completion/nsdo
@@ -0,0 +1,20 @@
+# nsdo(1) completion -*- shell-script -*-
+
+_nsdo()
+{
+ local cur prev words cword
+ _init_completion || return
+
+ if [[ $COMP_CWORD -eq 1 ]]; then
+ compopt -o filenames
+
+ # assume that the filenames in /var/run/netns don't contain
+ # newlines(!)
+ local IFS=$'\n'
+ COMPREPLY=( $(compgen -W "$(ip netns list)" -- "$cur") )
+ else
+ _command_offset 2
+ fi
+} && complete -F _nsdo nsdo
+
+# ex: ts=4 sw=4 et filetype=sh