#compdef sounding

autoload -U is-at-least

_sounding() {
    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]' \
":: :_sounding_commands" \
"*::: :->sounding" \
&& ret=0
    case $state in
    (sounding)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:sounding-command-$line[1]:"
        case $line[1] in
            (trajectory)
_arguments "${_arguments_options[@]}" : \
'--export-summary-json=[Export metrics to JSON with an optional output path]::JSON_FILE:_default' \
'--export-plots-dir=[Export SVG plots to an optional output directory]::DIR:_default' \
'-d+[Time delta in seconds for Relative Pose Error (RPE)]:DELTA:_default' \
'--delta=[Time delta in seconds for Relative Pose Error (RPE)]:DELTA:_default' \
'--reference-body-extrinsic=[Transform reference poses into another body frame, as qx,qy,qz,qw,x,y,z]:QX,QY,QZ,QW,X,Y,Z:_default' \
'--json[Print metrics as JSON to stdout]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
':estimated_file -- Path to estimated trajectory in TUM format:_files' \
':reference_file -- Path to reference trajectory in TUM format:_files' \
&& ret=0
;;
(completions)
_arguments "${_arguments_options[@]}" : \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'::shell -- The shell whose completion script should be printed:(bash elvish fish powershell zsh)' \
&& ret=0
;;
(probe)
_arguments "${_arguments_options[@]}" : \
'--output-dir=[Output directory for probe CSV, summary JSON, and plots]:OUTPUT_DIR:_files' \
'-i+[Sampling interval in seconds]:INTERVAL:_default' \
'--interval=[Sampling interval in seconds]:INTERVAL:_default' \
'--json[Print probe metrics as JSON to stdout]' \
'-s[Require an exact process-name match]' \
'--strict[Require an exact process-name match]' \
'-h[Print help]' \
'--help[Print help]' \
':target -- Target process ID or name:_default' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_sounding__subcmd__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:sounding-help-command-$line[1]:"
        case $line[1] in
            (trajectory)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(completions)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(probe)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_sounding_commands] )) ||
_sounding_commands() {
    local commands; commands=(
'trajectory:Evaluate trajectories' \
'completions:Install shell completions, or print them for a specific shell' \
'probe:Probe system and process resources' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'sounding commands' commands "$@"
}
(( $+functions[_sounding__subcmd__completions_commands] )) ||
_sounding__subcmd__completions_commands() {
    local commands; commands=()
    _describe -t commands 'sounding completions commands' commands "$@"
}
(( $+functions[_sounding__subcmd__help_commands] )) ||
_sounding__subcmd__help_commands() {
    local commands; commands=(
'trajectory:Evaluate trajectories' \
'completions:Install shell completions, or print them for a specific shell' \
'probe:Probe system and process resources' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'sounding help commands' commands "$@"
}
(( $+functions[_sounding__subcmd__help__subcmd__completions_commands] )) ||
_sounding__subcmd__help__subcmd__completions_commands() {
    local commands; commands=()
    _describe -t commands 'sounding help completions commands' commands "$@"
}
(( $+functions[_sounding__subcmd__help__subcmd__help_commands] )) ||
_sounding__subcmd__help__subcmd__help_commands() {
    local commands; commands=()
    _describe -t commands 'sounding help help commands' commands "$@"
}
(( $+functions[_sounding__subcmd__help__subcmd__probe_commands] )) ||
_sounding__subcmd__help__subcmd__probe_commands() {
    local commands; commands=()
    _describe -t commands 'sounding help probe commands' commands "$@"
}
(( $+functions[_sounding__subcmd__help__subcmd__trajectory_commands] )) ||
_sounding__subcmd__help__subcmd__trajectory_commands() {
    local commands; commands=()
    _describe -t commands 'sounding help trajectory commands' commands "$@"
}
(( $+functions[_sounding__subcmd__probe_commands] )) ||
_sounding__subcmd__probe_commands() {
    local commands; commands=()
    _describe -t commands 'sounding probe commands' commands "$@"
}
(( $+functions[_sounding__subcmd__trajectory_commands] )) ||
_sounding__subcmd__trajectory_commands() {
    local commands; commands=()
    _describe -t commands 'sounding trajectory commands' commands "$@"
}

if [ "$funcstack[1]" = "_sounding" ]; then
    _sounding "$@"
else
    compdef _sounding sounding
fi
