#compdef soundcraft-cli

autoload -U is-at-least

_soundcraft-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[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_soundcraft-cli_commands" \
"*::: :->soundcraft-cli" \
&& ret=0
    case $state in
    (soundcraft-cli)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:soundcraft-cli-command-$line[1]:"
        case $line[1] in
            (info)
_arguments "${_arguments_options[@]}" : \
'--compact[One line of JSON instead of pretty-printed (a .scraft summary is text and ignores it)]' \
'-h[Print help]' \
'--help[Print help]' \
':file -- An audio file (wav, wave, bwf, rf64, aif, aiff, aifc, flac, mp3, mp2, mp1, ogg, oga, m4a, m4b, aac, mp4, adts, caf, mkv, webm) or a .scraft session:_files' \
&& ret=0
;;
(convert)
_arguments "${_arguments_options[@]}" : \
'--bit-depth=[The output'\''s bit depth]:16|24|32f:(16 24 32f)' \
'--rate=[Resample to this sample rate]:HZ:_default' \
'--normalize[Normalize the peak to -0.1 dBFS]' \
'(--no-dither)--dither[Always dither]' \
'--no-dither[Never dither]' \
'--in-place[Allow an <OUT> that is the <IN> file, replacing the original]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
':input -- The audio file to read (wav, wave, bwf, rf64, aif, aiff, aifc, flac, mp3, mp2, mp1, ogg, oga, m4a, m4b, aac, mp4, adts, caf, mkv, webm):_files' \
':output -- The audio file to write; its extension picks the format (wav, wave, bwf, aif, aiff, flac):_files' \
&& ret=0
;;
(run)
_arguments "${_arguments_options[@]}" : \
'*--cmd=[An engine command, with its JSON parameters after \`=\` (default {}); repeat for several, run in order]:ID[=JSON]:_default' \
'(--demo)--in=[Open this session first]:S.scraft:_files' \
'--bounce=[Bounce the mix to this file at the end; without --start and --end, the whole session]:OUT:_files' \
'--start=[Where the bounce starts\: seconds (12.5) or a time string]:T:_default' \
'--end=[Where the bounce ends\: seconds (12.5) or a time string]:T:_default' \
'--save=[Save the session to this file at the end, replacing it]:S.scraft:_files' \
'--demo[Start from the demo session]' \
'--sample[Start from the demo session]' \
'--inspect[Print the session as JSON at the end]' \
'--compact[Print the --inspect JSON on one line instead of pretty-printed]' \
'--in-place[Allow a --save that is the --in session, replacing the original]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
&& ret=0
;;
(script)
_arguments "${_arguments_options[@]}" : \
'(--demo)--in=[Open this session first]:S.scraft:_files' \
'--bounce=[Bounce the mix to this file at the end; without --start and --end, the whole session]:OUT:_files' \
'--start=[Where the bounce starts\: seconds (12.5) or a time string]:T:_default' \
'--end=[Where the bounce ends\: seconds (12.5) or a time string]:T:_default' \
'--save=[Save the session to this file at the end, replacing it]:S.scraft:_files' \
'--keep-going[Continue after command errors and finish requested output, then exit nonzero if any command failed. Malformed JSON stops immediately]' \
'--demo[Start from the demo session]' \
'--sample[Start from the demo session]' \
'--inspect[Print the session as JSON at the end]' \
'--compact[Print the --inspect JSON on one line instead of pretty-printed]' \
'--in-place[Allow a --save that is the --in session, replacing the original]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
':file -- The script to run:_files' \
&& ret=0
;;
(commands)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
'::filter -- Only the commands whose id, or label in any case, contains this text:_default' \
&& ret=0
;;
(describe)
_arguments "${_arguments_options[@]}" : \
'--compact[One line of JSON instead of pretty-printed]' \
'-h[Print help]' \
'--help[Print help]' \
':id -- The command'\''s id, such as file.bounce_mix:_default' \
&& ret=0
;;
(app)
_arguments "${_arguments_options[@]}" : \
'--port=[The app'\''s control port or host\:port]:P:_default' \
'--compact[One line of JSON instead of pretty-printed]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
':method -- A control method or engine command id:_default' \
'::json -- Its parameters as JSON \[default\: {}\]:_default' \
&& ret=0
;;
(mcp)
_arguments "${_arguments_options[@]}" : \
'(--demo --automation-read-root --automation-write-root)--connect=[Serve a running app'\''s control channel at this port or host\:port instead of an in-process engine; conflicts with --demo, which starts only that engine]:PORT:_default' \
'*--automation-read-root=[A folder the agent'\''s commands may read from; repeat for several]:DIR:_files' \
'*--automation-write-root=[A folder the agent'\''s commands may write to; repeat for several]:DIR:_files' \
'--demo[Start the in-process engine from the demo session]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
&& ret=0
;;
(parity)
_arguments "${_arguments_options[@]}" : \
'--write=[Write the report to this file instead]:PATH:_files' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(plugins)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_soundcraft-cli__subcmd__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:soundcraft-cli-help-command-$line[1]:"
        case $line[1] in
            (info)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(convert)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(run)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(script)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(commands)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(describe)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(app)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(mcp)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(parity)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(plugins)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_soundcraft-cli_commands] )) ||
_soundcraft-cli_commands() {
    local commands; commands=(
'info:Print an audio file'\''s format as JSON, or a .scraft session'\''s summary' \
'convert:Convert an audio file\: resample, change the bit depth, normalize' \
'run:Run engine commands on a new, demo or saved session' \
'script:Run a file of engine commands, one \`ID JSON\` per line' \
'commands:List the engine commands' \
'describe:Print one engine command'\''s details as JSON' \
'app:Call a running app'\''s control channel' \
'mcp:Serve MCP on stdin and stdout' \
'parity:Print the parity report (markdown)' \
'plugins:List the built-in plugins' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'soundcraft-cli commands' commands "$@"
}
(( $+functions[_soundcraft-cli__subcmd__app_commands] )) ||
_soundcraft-cli__subcmd__app_commands() {
    local commands; commands=()
    _describe -t commands 'soundcraft-cli app commands' commands "$@"
}
(( $+functions[_soundcraft-cli__subcmd__commands_commands] )) ||
_soundcraft-cli__subcmd__commands_commands() {
    local commands; commands=()
    _describe -t commands 'soundcraft-cli commands commands' commands "$@"
}
(( $+functions[_soundcraft-cli__subcmd__convert_commands] )) ||
_soundcraft-cli__subcmd__convert_commands() {
    local commands; commands=()
    _describe -t commands 'soundcraft-cli convert commands' commands "$@"
}
(( $+functions[_soundcraft-cli__subcmd__describe_commands] )) ||
_soundcraft-cli__subcmd__describe_commands() {
    local commands; commands=()
    _describe -t commands 'soundcraft-cli describe commands' commands "$@"
}
(( $+functions[_soundcraft-cli__subcmd__help_commands] )) ||
_soundcraft-cli__subcmd__help_commands() {
    local commands; commands=(
'info:Print an audio file'\''s format as JSON, or a .scraft session'\''s summary' \
'convert:Convert an audio file\: resample, change the bit depth, normalize' \
'run:Run engine commands on a new, demo or saved session' \
'script:Run a file of engine commands, one \`ID JSON\` per line' \
'commands:List the engine commands' \
'describe:Print one engine command'\''s details as JSON' \
'app:Call a running app'\''s control channel' \
'mcp:Serve MCP on stdin and stdout' \
'parity:Print the parity report (markdown)' \
'plugins:List the built-in plugins' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'soundcraft-cli help commands' commands "$@"
}
(( $+functions[_soundcraft-cli__subcmd__help__subcmd__app_commands] )) ||
_soundcraft-cli__subcmd__help__subcmd__app_commands() {
    local commands; commands=()
    _describe -t commands 'soundcraft-cli help app commands' commands "$@"
}
(( $+functions[_soundcraft-cli__subcmd__help__subcmd__commands_commands] )) ||
_soundcraft-cli__subcmd__help__subcmd__commands_commands() {
    local commands; commands=()
    _describe -t commands 'soundcraft-cli help commands commands' commands "$@"
}
(( $+functions[_soundcraft-cli__subcmd__help__subcmd__convert_commands] )) ||
_soundcraft-cli__subcmd__help__subcmd__convert_commands() {
    local commands; commands=()
    _describe -t commands 'soundcraft-cli help convert commands' commands "$@"
}
(( $+functions[_soundcraft-cli__subcmd__help__subcmd__describe_commands] )) ||
_soundcraft-cli__subcmd__help__subcmd__describe_commands() {
    local commands; commands=()
    _describe -t commands 'soundcraft-cli help describe commands' commands "$@"
}
(( $+functions[_soundcraft-cli__subcmd__help__subcmd__help_commands] )) ||
_soundcraft-cli__subcmd__help__subcmd__help_commands() {
    local commands; commands=()
    _describe -t commands 'soundcraft-cli help help commands' commands "$@"
}
(( $+functions[_soundcraft-cli__subcmd__help__subcmd__info_commands] )) ||
_soundcraft-cli__subcmd__help__subcmd__info_commands() {
    local commands; commands=()
    _describe -t commands 'soundcraft-cli help info commands' commands "$@"
}
(( $+functions[_soundcraft-cli__subcmd__help__subcmd__mcp_commands] )) ||
_soundcraft-cli__subcmd__help__subcmd__mcp_commands() {
    local commands; commands=()
    _describe -t commands 'soundcraft-cli help mcp commands' commands "$@"
}
(( $+functions[_soundcraft-cli__subcmd__help__subcmd__parity_commands] )) ||
_soundcraft-cli__subcmd__help__subcmd__parity_commands() {
    local commands; commands=()
    _describe -t commands 'soundcraft-cli help parity commands' commands "$@"
}
(( $+functions[_soundcraft-cli__subcmd__help__subcmd__plugins_commands] )) ||
_soundcraft-cli__subcmd__help__subcmd__plugins_commands() {
    local commands; commands=()
    _describe -t commands 'soundcraft-cli help plugins commands' commands "$@"
}
(( $+functions[_soundcraft-cli__subcmd__help__subcmd__run_commands] )) ||
_soundcraft-cli__subcmd__help__subcmd__run_commands() {
    local commands; commands=()
    _describe -t commands 'soundcraft-cli help run commands' commands "$@"
}
(( $+functions[_soundcraft-cli__subcmd__help__subcmd__script_commands] )) ||
_soundcraft-cli__subcmd__help__subcmd__script_commands() {
    local commands; commands=()
    _describe -t commands 'soundcraft-cli help script commands' commands "$@"
}
(( $+functions[_soundcraft-cli__subcmd__info_commands] )) ||
_soundcraft-cli__subcmd__info_commands() {
    local commands; commands=()
    _describe -t commands 'soundcraft-cli info commands' commands "$@"
}
(( $+functions[_soundcraft-cli__subcmd__mcp_commands] )) ||
_soundcraft-cli__subcmd__mcp_commands() {
    local commands; commands=()
    _describe -t commands 'soundcraft-cli mcp commands' commands "$@"
}
(( $+functions[_soundcraft-cli__subcmd__parity_commands] )) ||
_soundcraft-cli__subcmd__parity_commands() {
    local commands; commands=()
    _describe -t commands 'soundcraft-cli parity commands' commands "$@"
}
(( $+functions[_soundcraft-cli__subcmd__plugins_commands] )) ||
_soundcraft-cli__subcmd__plugins_commands() {
    local commands; commands=()
    _describe -t commands 'soundcraft-cli plugins commands' commands "$@"
}
(( $+functions[_soundcraft-cli__subcmd__run_commands] )) ||
_soundcraft-cli__subcmd__run_commands() {
    local commands; commands=()
    _describe -t commands 'soundcraft-cli run commands' commands "$@"
}
(( $+functions[_soundcraft-cli__subcmd__script_commands] )) ||
_soundcraft-cli__subcmd__script_commands() {
    local commands; commands=()
    _describe -t commands 'soundcraft-cli script commands' commands "$@"
}

if [ "$funcstack[1]" = "_soundcraft-cli" ]; then
    _soundcraft-cli "$@"
else
    compdef _soundcraft-cli soundcraft-cli
fi
