#!/usr/bin/env bash
# Copyright (c) 2021 The Toltec Contributors
# SPDX-License-Identifier: MIT
# shellcheck disable=SC2016,SC2199,SC2207

_toltecctl() {
    local cur prev words cword split
    _init_completion -s || return

    if [[ $cword -eq 1 ]]; then
        COMPREPLY=($(compgen -W 'help generate-opkg-conf switch-branch reenable uninstall status' -- "$cur"))
        return
    fi

    if [[ $cword -eq 2 && ${words[1]} = 'switch-branch' ]]; then
        COMPREPLY=($(compgen -W 'stable testing' -- "$cur"))
        return
    fi
}

complete -F _toltecctl toltecctl
