aboutsummaryrefslogtreecommitdiff
path: root/etc/bash_completion.d/updatezone
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2017-10-14 17:31:56 -0400
committerB Stack <bgstack15@gmail.com>2017-10-14 17:31:56 -0400
commit84bc002ada26576ca5886d07a76d7ec16d27ddf4 (patch)
treeada755e5cef141050a9bad38b7690bdc12917ac7 /etc/bash_completion.d/updatezone
parentarrange directory structure to current standards (diff)
downloadddtools-84bc002ada26576ca5886d07a76d7ec16d27ddf4.tar.gz
ddtools-84bc002ada26576ca5886d07a76d7ec16d27ddf4.tar.bz2
ddtools-84bc002ada26576ca5886d07a76d7ec16d27ddf4.zip
add bash autocompletion for updatezone
Diffstat (limited to 'etc/bash_completion.d/updatezone')
-rw-r--r--etc/bash_completion.d/updatezone13
1 files changed, 13 insertions, 0 deletions
diff --git a/etc/bash_completion.d/updatezone b/etc/bash_completion.d/updatezone
new file mode 100644
index 0000000..f55d1ce
--- /dev/null
+++ b/etc/bash_completion.d/updatezone
@@ -0,0 +1,13 @@
+_updatezone_autocomplete() {
+ #devtty=/dev/pts/2
+ local cur prev words cword;
+ _init_completion || return
+ local _tmpfile1="$( mktemp )"
+ grep -iE "UZ_ZONE_NAME=" /etc/ddtools/*.conf 2>/dev/null | sed -r -e 's/^UZ_.*=//;' >> "${_tmpfile1}"
+ #echo "----- ${cur} --- prev: ${prev} -- words: ${words} -- cword: ${cword} --" > "${devtty}"
+ grep -viE "${cur}" "${_tmpfile1}"
+ COMPREPLY=($( compgen -W "$( grep -viE "${prev}" "${_tmpfile1}" )" -- "$cur" ))
+ command rm -f "${_tmpfile1}" 1>/dev/null 2>&1
+ return 0
+}
+complete -F _updatezone_autocomplete updatezone
bgstack15