aboutsummaryrefslogblamecommitdiff
path: root/nagscripts.bash
blob: 11ec4fb25609a0add77377e7911510281fe0eb8d (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13












                                                                              
                             



                                                            
 


                                        
                            


                            
                      
# Source this file to get host and service completion for the Nagscript tools.
_nagios_objects() {
    local word=${COMP_WORDS[COMP_CWORD]}
    declare -a cmd
    case $word in
        */*)
            cmd=(nagios-data-search -s ^"${word#*/}")
            ;;
        *)
            compopt -o nospace
            cmd=(nagios-data-search ^"$word")
            ;;
    esac
    while read -r object ; do
        case $object in
            "$word"*) COMPREPLY[${#COMPREPLY[@]}]=$object ;;
        esac
    done < <("${cmd[@]}")
}
complete -F _nagios_objects -o default \
    nagios-acknowledge     \
    nagios-clear           \
    nagios-downstream-list \
    nagios-data-search     \
    nagios-downtime        \
    nagios-exists          \
    nagios-force-check