#compdef bb-imager-cli

autoload -U is-at-least

_bb-imager-cli() {
    typeset -A opt_args
    typeset -a _arguments_options
    local ret=1

    if is-at-least 5.2; then
        _arguments_options=(-s -S -C)
    else
        _arguments_options=(-s -C)
    fi

    local context curcontext="$curcontext" state line
    _arguments "${_arguments_options[@]}" : \
'--verbose[Enable more logging]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_bb-imager-cli_commands" \
"*::: :->xtask" \
&& ret=0
    case $state in
    (xtask)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:bb-imager-cli-command-$line[1]:"
        case $line[1] in
            (flash)
_arguments "${_arguments_options[@]}" : \
'--quiet[Suppress standard output messages for a quieter experience]' \
'-h[Print help]' \
'--help[Print help]' \
":: :_bb-imager-cli__subcmd__flash_commands" \
"*::: :->flash" \
&& ret=0

    case $state in
    (flash)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:bb-imager-cli-flash-command-$line[1]:"
        case $line[1] in
            (bcf)
_arguments "${_arguments_options[@]}" : \
'--no-verify[Disable checksum verification after flashing to speed up the process]' \
'-h[Print help]' \
'--help[Print help]' \
':img -- Local path to image file. Can be compressed (xz) or extracted file:_default' \
':dst -- The destination device (e.g., `/dev/sdX` or specific device identifiers):_default' \
&& ret=0
;;
(sd)
_arguments "${_arguments_options[@]}" : \
'--hostname=[Set a custom hostname for the device (e.g., "beaglebone")]:HOSTNAME:_default' \
'--timezone=[Set the timezone for the device (e.g., "America/New_York")]:TIMEZONE:_default' \
'--keymap=[Set the keyboard layout/keymap (e.g., "us" for the US layout)]:KEYMAP:_default' \
'--user-name=[Set a username for the default user. Cannot be \`root\`. Requires \`user_password\`. Required to enter GUI session due to regulatory requirements.]:USER_NAME:_default' \
'--user-password=[Set a password for the default user. Requires \`user_name\`. Required to enter GUI session due to regulatory requirements.]:USER_PASSWORD:_default' \
'--wifi-ssid=[Configure a Wi-Fi SSID for network access. Requires \`wifi_password\`]:WIFI_SSID:_default' \
'--wifi-password=[Set the password for the specified Wi-Fi SSID. Requires \`wifi_ssid\`]:WIFI_PASSWORD:_default' \
'--ssh-key=[Set SSH public key for authentication]:SSH_KEY:_default' \
'--bmap=[Provide the bmap file for the image]:BMAP:_default' \
'--usb-enable-dhcp[Enable USB DHCP]' \
'-h[Print help]' \
'--help[Print help]' \
':img -- Local path to image file. Can be compressed (xz) or extracted file:_default' \
':dst -- The destination device (e.g., `/dev/sdX` or specific device identifiers):_files' \
&& ret=0
;;
(msp430)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
':img -- Local path to image file. Can be compressed (xz) or extracted file:_default' \
':dst -- The destination device (e.g., `/dev/sdX` or specific device identifiers):_default' \
&& ret=0
;;
(dfu)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
':identifier -- Identifer is in the following format\: `{bus_num}\:{address}\:{vendor_id}\:{product_id}`. All fields are in hex:_default' \
'*::imgs -- Format {name} followed by {path}. Any number of firmware can be specified, which will be flashed in a sequential order:_default' \
&& ret=0
;;
(zepto)
_arguments "${_arguments_options[@]}" : \
'--reset-gpio=[RESET GPIO for MSPM0]:RESET_GPIO:_default' \
'--bsl-gpio=[BSL GPIO for MSPM0]:BSL_GPIO:_default' \
'--no-verify[Disable checksum verification after flashing to speed up the process]' \
'-h[Print help]' \
'--help[Print help]' \
':img -- Local path to image file. Can be compressed (xz) or extracted file:_default' \
':dst -- The destination device (e.g., `/dev/tty*` or `/dev/i2c-*` or specific device identifiers):_default' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_bb-imager-cli__subcmd__flash__subcmd__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:bb-imager-cli-flash-help-command-$line[1]:"
        case $line[1] in
            (bcf)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(sd)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(msp430)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(dfu)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(zepto)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
;;
(list-destinations)
_arguments "${_arguments_options[@]}" : \
'--no-frills[Only print paths seperated by newline]' \
'--no-filter[Show all possible destinations without any sanity filters. Can be used when a device is not visible due to incorrect reporting by OS]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
':target -- Specifies the target type for listing destinations:((bcf\:"BeagleConnect Freedom targets"
sd\:"SD card targets for BeagleBoard devices"
msp430\:"MSP430 targets"
dfu\:"USB DFU Target"
zepto\:"Zepto Target"))' \
&& ret=0
;;
(format)
_arguments "${_arguments_options[@]}" : \
'--quiet[Suppress standard output messages for a quieter experience]' \
'-h[Print help]' \
'--help[Print help]' \
':dst -- The destination device (e.g., `/dev/sdX` or specific device identifiers):_files' \
&& ret=0
;;
(generate-completion)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
':shell -- Specifies the target shell type for completion:(bash elvish fish powershell zsh)' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_bb-imager-cli__subcmd__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:bb-imager-cli-help-command-$line[1]:"
        case $line[1] in
            (flash)
_arguments "${_arguments_options[@]}" : \
":: :_bb-imager-cli__subcmd__help__subcmd__flash_commands" \
"*::: :->flash" \
&& ret=0

    case $state in
    (flash)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:bb-imager-cli-help-flash-command-$line[1]:"
        case $line[1] in
            (bcf)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(sd)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(msp430)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(dfu)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(zepto)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
(list-destinations)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(format)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(generate-completion)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_bb-imager-cli_commands] )) ||
_bb-imager-cli_commands() {
    local commands; commands=(
'flash:Command to flash an image to a specific destination' \
'list-destinations:Command to list available destinations for flashing based on the selected target' \
'format:Command to format SD Card' \
'generate-completion:Command to generate shell completion' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'bb-imager-cli commands' commands "$@"
}
(( $+functions[_bb-imager-cli__subcmd__flash_commands] )) ||
_bb-imager-cli__subcmd__flash_commands() {
    local commands; commands=(
'bcf:Flash BeagleConnect Freedom' \
'sd:Flash an SD card with customizable settings for BeagleBoard devices' \
'msp430:Flash MSP430 on BeagleConnectFreedom' \
'dfu:' \
'zepto:Flash Zepto' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'bb-imager-cli flash commands' commands "$@"
}
(( $+functions[_bb-imager-cli__subcmd__flash__subcmd__bcf_commands] )) ||
_bb-imager-cli__subcmd__flash__subcmd__bcf_commands() {
    local commands; commands=()
    _describe -t commands 'bb-imager-cli flash bcf commands' commands "$@"
}
(( $+functions[_bb-imager-cli__subcmd__flash__subcmd__dfu_commands] )) ||
_bb-imager-cli__subcmd__flash__subcmd__dfu_commands() {
    local commands; commands=()
    _describe -t commands 'bb-imager-cli flash dfu commands' commands "$@"
}
(( $+functions[_bb-imager-cli__subcmd__flash__subcmd__help_commands] )) ||
_bb-imager-cli__subcmd__flash__subcmd__help_commands() {
    local commands; commands=(
'bcf:Flash BeagleConnect Freedom' \
'sd:Flash an SD card with customizable settings for BeagleBoard devices' \
'msp430:Flash MSP430 on BeagleConnectFreedom' \
'dfu:' \
'zepto:Flash Zepto' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'bb-imager-cli flash help commands' commands "$@"
}
(( $+functions[_bb-imager-cli__subcmd__flash__subcmd__help__subcmd__bcf_commands] )) ||
_bb-imager-cli__subcmd__flash__subcmd__help__subcmd__bcf_commands() {
    local commands; commands=()
    _describe -t commands 'bb-imager-cli flash help bcf commands' commands "$@"
}
(( $+functions[_bb-imager-cli__subcmd__flash__subcmd__help__subcmd__dfu_commands] )) ||
_bb-imager-cli__subcmd__flash__subcmd__help__subcmd__dfu_commands() {
    local commands; commands=()
    _describe -t commands 'bb-imager-cli flash help dfu commands' commands "$@"
}
(( $+functions[_bb-imager-cli__subcmd__flash__subcmd__help__subcmd__help_commands] )) ||
_bb-imager-cli__subcmd__flash__subcmd__help__subcmd__help_commands() {
    local commands; commands=()
    _describe -t commands 'bb-imager-cli flash help help commands' commands "$@"
}
(( $+functions[_bb-imager-cli__subcmd__flash__subcmd__help__subcmd__msp430_commands] )) ||
_bb-imager-cli__subcmd__flash__subcmd__help__subcmd__msp430_commands() {
    local commands; commands=()
    _describe -t commands 'bb-imager-cli flash help msp430 commands' commands "$@"
}
(( $+functions[_bb-imager-cli__subcmd__flash__subcmd__help__subcmd__sd_commands] )) ||
_bb-imager-cli__subcmd__flash__subcmd__help__subcmd__sd_commands() {
    local commands; commands=()
    _describe -t commands 'bb-imager-cli flash help sd commands' commands "$@"
}
(( $+functions[_bb-imager-cli__subcmd__flash__subcmd__help__subcmd__zepto_commands] )) ||
_bb-imager-cli__subcmd__flash__subcmd__help__subcmd__zepto_commands() {
    local commands; commands=()
    _describe -t commands 'bb-imager-cli flash help zepto commands' commands "$@"
}
(( $+functions[_bb-imager-cli__subcmd__flash__subcmd__msp430_commands] )) ||
_bb-imager-cli__subcmd__flash__subcmd__msp430_commands() {
    local commands; commands=()
    _describe -t commands 'bb-imager-cli flash msp430 commands' commands "$@"
}
(( $+functions[_bb-imager-cli__subcmd__flash__subcmd__sd_commands] )) ||
_bb-imager-cli__subcmd__flash__subcmd__sd_commands() {
    local commands; commands=()
    _describe -t commands 'bb-imager-cli flash sd commands' commands "$@"
}
(( $+functions[_bb-imager-cli__subcmd__flash__subcmd__zepto_commands] )) ||
_bb-imager-cli__subcmd__flash__subcmd__zepto_commands() {
    local commands; commands=()
    _describe -t commands 'bb-imager-cli flash zepto commands' commands "$@"
}
(( $+functions[_bb-imager-cli__subcmd__format_commands] )) ||
_bb-imager-cli__subcmd__format_commands() {
    local commands; commands=()
    _describe -t commands 'bb-imager-cli format commands' commands "$@"
}
(( $+functions[_bb-imager-cli__subcmd__generate-completion_commands] )) ||
_bb-imager-cli__subcmd__generate-completion_commands() {
    local commands; commands=()
    _describe -t commands 'bb-imager-cli generate-completion commands' commands "$@"
}
(( $+functions[_bb-imager-cli__subcmd__help_commands] )) ||
_bb-imager-cli__subcmd__help_commands() {
    local commands; commands=(
'flash:Command to flash an image to a specific destination' \
'list-destinations:Command to list available destinations for flashing based on the selected target' \
'format:Command to format SD Card' \
'generate-completion:Command to generate shell completion' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'bb-imager-cli help commands' commands "$@"
}
(( $+functions[_bb-imager-cli__subcmd__help__subcmd__flash_commands] )) ||
_bb-imager-cli__subcmd__help__subcmd__flash_commands() {
    local commands; commands=(
'bcf:Flash BeagleConnect Freedom' \
'sd:Flash an SD card with customizable settings for BeagleBoard devices' \
'msp430:Flash MSP430 on BeagleConnectFreedom' \
'dfu:' \
'zepto:Flash Zepto' \
    )
    _describe -t commands 'bb-imager-cli help flash commands' commands "$@"
}
(( $+functions[_bb-imager-cli__subcmd__help__subcmd__flash__subcmd__bcf_commands] )) ||
_bb-imager-cli__subcmd__help__subcmd__flash__subcmd__bcf_commands() {
    local commands; commands=()
    _describe -t commands 'bb-imager-cli help flash bcf commands' commands "$@"
}
(( $+functions[_bb-imager-cli__subcmd__help__subcmd__flash__subcmd__dfu_commands] )) ||
_bb-imager-cli__subcmd__help__subcmd__flash__subcmd__dfu_commands() {
    local commands; commands=()
    _describe -t commands 'bb-imager-cli help flash dfu commands' commands "$@"
}
(( $+functions[_bb-imager-cli__subcmd__help__subcmd__flash__subcmd__msp430_commands] )) ||
_bb-imager-cli__subcmd__help__subcmd__flash__subcmd__msp430_commands() {
    local commands; commands=()
    _describe -t commands 'bb-imager-cli help flash msp430 commands' commands "$@"
}
(( $+functions[_bb-imager-cli__subcmd__help__subcmd__flash__subcmd__sd_commands] )) ||
_bb-imager-cli__subcmd__help__subcmd__flash__subcmd__sd_commands() {
    local commands; commands=()
    _describe -t commands 'bb-imager-cli help flash sd commands' commands "$@"
}
(( $+functions[_bb-imager-cli__subcmd__help__subcmd__flash__subcmd__zepto_commands] )) ||
_bb-imager-cli__subcmd__help__subcmd__flash__subcmd__zepto_commands() {
    local commands; commands=()
    _describe -t commands 'bb-imager-cli help flash zepto commands' commands "$@"
}
(( $+functions[_bb-imager-cli__subcmd__help__subcmd__format_commands] )) ||
_bb-imager-cli__subcmd__help__subcmd__format_commands() {
    local commands; commands=()
    _describe -t commands 'bb-imager-cli help format commands' commands "$@"
}
(( $+functions[_bb-imager-cli__subcmd__help__subcmd__generate-completion_commands] )) ||
_bb-imager-cli__subcmd__help__subcmd__generate-completion_commands() {
    local commands; commands=()
    _describe -t commands 'bb-imager-cli help generate-completion commands' commands "$@"
}
(( $+functions[_bb-imager-cli__subcmd__help__subcmd__help_commands] )) ||
_bb-imager-cli__subcmd__help__subcmd__help_commands() {
    local commands; commands=()
    _describe -t commands 'bb-imager-cli help help commands' commands "$@"
}
(( $+functions[_bb-imager-cli__subcmd__help__subcmd__list-destinations_commands] )) ||
_bb-imager-cli__subcmd__help__subcmd__list-destinations_commands() {
    local commands; commands=()
    _describe -t commands 'bb-imager-cli help list-destinations commands' commands "$@"
}
(( $+functions[_bb-imager-cli__subcmd__list-destinations_commands] )) ||
_bb-imager-cli__subcmd__list-destinations_commands() {
    local commands; commands=()
    _describe -t commands 'bb-imager-cli list-destinations commands' commands "$@"
}

if [ "$funcstack[1]" = "_bb-imager-cli" ]; then
    _bb-imager-cli "$@"
else
    compdef _bb-imager-cli bb-imager-cli
fi
