# bash completion for dreamdump                                  -*- shell-script -*-
# shellcheck shell=bash
#
# GENERATED by scripts/completions/gen.py from MoriGM/dreamdump at 0.6.2.
# Do not edit: change the generator, then run `scripts/completions/gen.py write`.
#
# dreamdump reads a value only as --option=VALUE (`--option VALUE` is ignored),
# so only that form is offered. Not in its usage line: --force-qtoc --read-at-once

_mediapres_dreamdump()
{
    # shellcheck disable=SC2034  # words is filled in by _init_completion
    local cur prev words cword split
    _init_completion -s || return

    if $split; then
        case $prev in
            --drive)
                local d
                COMPREPLY=()
                for d in /dev/sr[0-9]*; do
                    [[ -e $d && $d == "$cur"* ]] && COMPREPLY+=("$d")
                done
                ((${#COMPREPLY[@]})) || _filedir
                ;;
            --image-path)
                _filedir -d
                ;;
            --sector-order)
                mapfile -t COMPREPLY < <(compgen -W 'DATA_C2 DATA_SUB DATA_C2_SUB DATA_SUB_C2' -- "$cur")
                ;;
        esac
        return
    fi

    if [[ $cur == -* ]]; then
        mapfile -t COMPREPLY < <(compgen -W '--force-sector-order --force-qtoc --train --cutoff= --retries= --image-name= --image-path= --read-offset= --read-at-once= --speed= --sector-order= --drive=' -- "$cur")
        [[ ${COMPREPLY-} == *= ]] && compopt -o nospace
        return
    fi
    # the command must be the first argument
    ((cword == 1)) && mapfile -t COMPREPLY < <(compgen -W 'disc split' -- "$cur")
} &&
    complete -F _mediapres_dreamdump dreamdump

# ex: filetype=sh
