# Linux iwlist(8) completion


comp_include _available_interfaces _get_cword


_iwlist()
{
    local cur prev

    COMPREPLY=()
    cur=`_get_cword`
    prev=${COMP_WORDS[COMP_CWORD-1]}
    
    if [ $COMP_CWORD -eq 1 ]; then
        if [[ "$cur" == -* ]]; then
            COMPREPLY=( $( compgen -W '--help --version' -- $cur ) ) 
        else
            _available_interfaces -w
        fi
    else
        COMPREPLY=( $( compgen -W 'scan scanning freq frequency \
            channel rate bit bitrate key enc encryption power \
            txpower retry ap accesspoint peers event' -- $cur ) ) 
    fi
}
