aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nagscripts.bash9
1 files changed, 4 insertions, 5 deletions
diff --git a/nagscripts.bash b/nagscripts.bash
index 2e35e7b..5f95575 100644
--- a/nagscripts.bash
+++ b/nagscripts.bash
@@ -1,11 +1,10 @@
# Completion tools for Nagscripts suite
_nagscripts_objects() {
- local word=${COMP_WORDS[COMP_CWORD]}
- local -a objects
+ local object
while read -r object ; do
- objects=("${objects[@]}" "$object")
- done < <(cat <(nds .) <(nds -s .))
- COMPREPLY=( $(compgen -W "${objects[*]}" -- "$word") )
+ [[ $object == "${COMP_WORDS[COMP_CWORD]}"* ]] || continue
+ COMPREPLY[${#COMPREPLY[@]}]=$object
+ done < <(cat <(nagios-data-search .) <(nagios-data-search -s .))
return
}
complete -F _nagscripts_objects -o default \