_show_completions() {
    local cur prev commands interface_subs routes_subs
    COMPREPLY=()
    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    commands="dhcp interface ntp routes software stp"

    if [[ $COMP_CWORD -eq 1 ]]; then
        COMPREPLY=( $(compgen -W "$commands" -- "$cur") )
        return 0
    fi

    case "$prev" in
        interface)
            COMPREPLY=( $(compgen -W "$(ls /sys/class/net/)" -- "$cur") )
            ;;
        routes)
            COMPREPLY=( $(compgen -W "ipv4 ipv6" -- "$cur") )
            ;;
        software)
            COMPREPLY=( $(compgen -W "primary secondary" -- "$cur") )
            ;;
    esac
}

complete -F _show_completions show
