# glm bash completion

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

    commands="status logs update compliance enroll environment boot version start stop help"

    case "$prev" in
        glm)
            COMPREPLY=($(compgen -W "$commands" -- "$cur"))
            ;;
        update)
            COMPREPLY=($(compgen -W "system user" -- "$cur"))
            ;;
        compliance)
            COMPREPLY=($(compgen -W "check report report-json sync" -- "$cur"))
            ;;
        boot)
            COMPREPLY=($(compgen -W "show vars kernel" -- "$cur"))
            ;;
        *)
            ;;
    esac
}

complete -F _glm_completions glm
