#compdef sio

autoload -U is-at-least

_sio() {
    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[@]}" : \
'-f+[Output format]:FORMAT:(text json xml html)' \
'--format=[Output format]:FORMAT:(text json xml html)' \
'--interval=[Sensor polling interval in milliseconds]:INTERVAL:_default' \
'--log=[Log sensor data to CSV file while monitoring]:LOG:_files' \
'*--alert=[Sensor alert rules (e.g., "hwmon/nct6798/temp1 > 80 @30s")]:RULE:_default' \
'--color=[Color mode]:COLOR:(auto always never)' \
'-m[Run in TUI (interactive) sensor monitor mode (press '\''/'\'' to cross-filter)]' \
'--monitor[Run in TUI (interactive) sensor monitor mode (press '\''/'\'' to cross-filter)]' \
'--no-nvidia[Disable NVIDIA GPU detection]' \
'--direct-io[Enable direct I/O port and I2C sensor reading (requires root)]' \
'--show-empty[Show empty/unavailable fields]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_sio_commands" \
"*::: :->sio" \
&& ret=0
    case $state in
    (sio)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:sio-command-$line[1]:"
        case $line[1] in
            (cpu)
_arguments "${_arguments_options[@]}" : \
'-f+[Output format]:FORMAT:(text json xml html)' \
'--format=[Output format]:FORMAT:(text json xml html)' \
'--interval=[Sensor polling interval in milliseconds]:INTERVAL:_default' \
'--log=[Log sensor data to CSV file while monitoring]:LOG:_files' \
'*--alert=[Sensor alert rules (e.g., "hwmon/nct6798/temp1 > 80 @30s")]:RULE:_default' \
'--color=[Color mode]:COLOR:(auto always never)' \
'-m[Run in TUI (interactive) sensor monitor mode (press '\''/'\'' to cross-filter)]' \
'--monitor[Run in TUI (interactive) sensor monitor mode (press '\''/'\'' to cross-filter)]' \
'--no-nvidia[Disable NVIDIA GPU detection]' \
'--direct-io[Enable direct I/O port and I2C sensor reading (requires root)]' \
'--show-empty[Show empty/unavailable fields]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(gpu)
_arguments "${_arguments_options[@]}" : \
'-f+[Output format]:FORMAT:(text json xml html)' \
'--format=[Output format]:FORMAT:(text json xml html)' \
'--interval=[Sensor polling interval in milliseconds]:INTERVAL:_default' \
'--log=[Log sensor data to CSV file while monitoring]:LOG:_files' \
'*--alert=[Sensor alert rules (e.g., "hwmon/nct6798/temp1 > 80 @30s")]:RULE:_default' \
'--color=[Color mode]:COLOR:(auto always never)' \
'-m[Run in TUI (interactive) sensor monitor mode (press '\''/'\'' to cross-filter)]' \
'--monitor[Run in TUI (interactive) sensor monitor mode (press '\''/'\'' to cross-filter)]' \
'--no-nvidia[Disable NVIDIA GPU detection]' \
'--direct-io[Enable direct I/O port and I2C sensor reading (requires root)]' \
'--show-empty[Show empty/unavailable fields]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(memory)
_arguments "${_arguments_options[@]}" : \
'-f+[Output format]:FORMAT:(text json xml html)' \
'--format=[Output format]:FORMAT:(text json xml html)' \
'--interval=[Sensor polling interval in milliseconds]:INTERVAL:_default' \
'--log=[Log sensor data to CSV file while monitoring]:LOG:_files' \
'*--alert=[Sensor alert rules (e.g., "hwmon/nct6798/temp1 > 80 @30s")]:RULE:_default' \
'--color=[Color mode]:COLOR:(auto always never)' \
'-m[Run in TUI (interactive) sensor monitor mode (press '\''/'\'' to cross-filter)]' \
'--monitor[Run in TUI (interactive) sensor monitor mode (press '\''/'\'' to cross-filter)]' \
'--no-nvidia[Disable NVIDIA GPU detection]' \
'--direct-io[Enable direct I/O port and I2C sensor reading (requires root)]' \
'--show-empty[Show empty/unavailable fields]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(storage)
_arguments "${_arguments_options[@]}" : \
'-f+[Output format]:FORMAT:(text json xml html)' \
'--format=[Output format]:FORMAT:(text json xml html)' \
'--interval=[Sensor polling interval in milliseconds]:INTERVAL:_default' \
'--log=[Log sensor data to CSV file while monitoring]:LOG:_files' \
'*--alert=[Sensor alert rules (e.g., "hwmon/nct6798/temp1 > 80 @30s")]:RULE:_default' \
'--color=[Color mode]:COLOR:(auto always never)' \
'-m[Run in TUI (interactive) sensor monitor mode (press '\''/'\'' to cross-filter)]' \
'--monitor[Run in TUI (interactive) sensor monitor mode (press '\''/'\'' to cross-filter)]' \
'--no-nvidia[Disable NVIDIA GPU detection]' \
'--direct-io[Enable direct I/O port and I2C sensor reading (requires root)]' \
'--show-empty[Show empty/unavailable fields]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(network)
_arguments "${_arguments_options[@]}" : \
'-f+[Output format]:FORMAT:(text json xml html)' \
'--format=[Output format]:FORMAT:(text json xml html)' \
'--interval=[Sensor polling interval in milliseconds]:INTERVAL:_default' \
'--log=[Log sensor data to CSV file while monitoring]:LOG:_files' \
'*--alert=[Sensor alert rules (e.g., "hwmon/nct6798/temp1 > 80 @30s")]:RULE:_default' \
'--color=[Color mode]:COLOR:(auto always never)' \
'-m[Run in TUI (interactive) sensor monitor mode (press '\''/'\'' to cross-filter)]' \
'--monitor[Run in TUI (interactive) sensor monitor mode (press '\''/'\'' to cross-filter)]' \
'--no-nvidia[Disable NVIDIA GPU detection]' \
'--direct-io[Enable direct I/O port and I2C sensor reading (requires root)]' \
'--show-empty[Show empty/unavailable fields]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(pci)
_arguments "${_arguments_options[@]}" : \
'-f+[Output format]:FORMAT:(text json xml html)' \
'--format=[Output format]:FORMAT:(text json xml html)' \
'--interval=[Sensor polling interval in milliseconds]:INTERVAL:_default' \
'--log=[Log sensor data to CSV file while monitoring]:LOG:_files' \
'*--alert=[Sensor alert rules (e.g., "hwmon/nct6798/temp1 > 80 @30s")]:RULE:_default' \
'--color=[Color mode]:COLOR:(auto always never)' \
'-m[Run in TUI (interactive) sensor monitor mode (press '\''/'\'' to cross-filter)]' \
'--monitor[Run in TUI (interactive) sensor monitor mode (press '\''/'\'' to cross-filter)]' \
'--no-nvidia[Disable NVIDIA GPU detection]' \
'--direct-io[Enable direct I/O port and I2C sensor reading (requires root)]' \
'--show-empty[Show empty/unavailable fields]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(usb)
_arguments "${_arguments_options[@]}" : \
'-f+[Output format]:FORMAT:(text json xml html)' \
'--format=[Output format]:FORMAT:(text json xml html)' \
'--interval=[Sensor polling interval in milliseconds]:INTERVAL:_default' \
'--log=[Log sensor data to CSV file while monitoring]:LOG:_files' \
'*--alert=[Sensor alert rules (e.g., "hwmon/nct6798/temp1 > 80 @30s")]:RULE:_default' \
'--color=[Color mode]:COLOR:(auto always never)' \
'-m[Run in TUI (interactive) sensor monitor mode (press '\''/'\'' to cross-filter)]' \
'--monitor[Run in TUI (interactive) sensor monitor mode (press '\''/'\'' to cross-filter)]' \
'--no-nvidia[Disable NVIDIA GPU detection]' \
'--direct-io[Enable direct I/O port and I2C sensor reading (requires root)]' \
'--show-empty[Show empty/unavailable fields]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(audio)
_arguments "${_arguments_options[@]}" : \
'-f+[Output format]:FORMAT:(text json xml html)' \
'--format=[Output format]:FORMAT:(text json xml html)' \
'--interval=[Sensor polling interval in milliseconds]:INTERVAL:_default' \
'--log=[Log sensor data to CSV file while monitoring]:LOG:_files' \
'*--alert=[Sensor alert rules (e.g., "hwmon/nct6798/temp1 > 80 @30s")]:RULE:_default' \
'--color=[Color mode]:COLOR:(auto always never)' \
'-m[Run in TUI (interactive) sensor monitor mode (press '\''/'\'' to cross-filter)]' \
'--monitor[Run in TUI (interactive) sensor monitor mode (press '\''/'\'' to cross-filter)]' \
'--no-nvidia[Disable NVIDIA GPU detection]' \
'--direct-io[Enable direct I/O port and I2C sensor reading (requires root)]' \
'--show-empty[Show empty/unavailable fields]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(battery)
_arguments "${_arguments_options[@]}" : \
'-f+[Output format]:FORMAT:(text json xml html)' \
'--format=[Output format]:FORMAT:(text json xml html)' \
'--interval=[Sensor polling interval in milliseconds]:INTERVAL:_default' \
'--log=[Log sensor data to CSV file while monitoring]:LOG:_files' \
'*--alert=[Sensor alert rules (e.g., "hwmon/nct6798/temp1 > 80 @30s")]:RULE:_default' \
'--color=[Color mode]:COLOR:(auto always never)' \
'-m[Run in TUI (interactive) sensor monitor mode (press '\''/'\'' to cross-filter)]' \
'--monitor[Run in TUI (interactive) sensor monitor mode (press '\''/'\'' to cross-filter)]' \
'--no-nvidia[Disable NVIDIA GPU detection]' \
'--direct-io[Enable direct I/O port and I2C sensor reading (requires root)]' \
'--show-empty[Show empty/unavailable fields]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(board)
_arguments "${_arguments_options[@]}" : \
'-f+[Output format]:FORMAT:(text json xml html)' \
'--format=[Output format]:FORMAT:(text json xml html)' \
'--interval=[Sensor polling interval in milliseconds]:INTERVAL:_default' \
'--log=[Log sensor data to CSV file while monitoring]:LOG:_files' \
'*--alert=[Sensor alert rules (e.g., "hwmon/nct6798/temp1 > 80 @30s")]:RULE:_default' \
'--color=[Color mode]:COLOR:(auto always never)' \
'-m[Run in TUI (interactive) sensor monitor mode (press '\''/'\'' to cross-filter)]' \
'--monitor[Run in TUI (interactive) sensor monitor mode (press '\''/'\'' to cross-filter)]' \
'--no-nvidia[Disable NVIDIA GPU detection]' \
'--direct-io[Enable direct I/O port and I2C sensor reading (requires root)]' \
'--show-empty[Show empty/unavailable fields]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(pcie)
_arguments "${_arguments_options[@]}" : \
'-f+[Output format]:FORMAT:(text json xml html)' \
'--format=[Output format]:FORMAT:(text json xml html)' \
'--interval=[Sensor polling interval in milliseconds]:INTERVAL:_default' \
'--log=[Log sensor data to CSV file while monitoring]:LOG:_files' \
'*--alert=[Sensor alert rules (e.g., "hwmon/nct6798/temp1 > 80 @30s")]:RULE:_default' \
'--color=[Color mode]:COLOR:(auto always never)' \
'-m[Run in TUI (interactive) sensor monitor mode (press '\''/'\'' to cross-filter)]' \
'--monitor[Run in TUI (interactive) sensor monitor mode (press '\''/'\'' to cross-filter)]' \
'--no-nvidia[Disable NVIDIA GPU detection]' \
'--direct-io[Enable direct I/O port and I2C sensor reading (requires root)]' \
'--show-empty[Show empty/unavailable fields]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(sensors)
_arguments "${_arguments_options[@]}" : \
'-f+[Output format]:FORMAT:(text json xml html)' \
'--format=[Output format]:FORMAT:(text json xml html)' \
'--interval=[Sensor polling interval in milliseconds]:INTERVAL:_default' \
'--log=[Log sensor data to CSV file while monitoring]:LOG:_files' \
'*--alert=[Sensor alert rules (e.g., "hwmon/nct6798/temp1 > 80 @30s")]:RULE:_default' \
'--color=[Color mode]:COLOR:(auto always never)' \
'-m[Run in TUI (interactive) sensor monitor mode (press '\''/'\'' to cross-filter)]' \
'--monitor[Run in TUI (interactive) sensor monitor mode (press '\''/'\'' to cross-filter)]' \
'--no-nvidia[Disable NVIDIA GPU detection]' \
'--direct-io[Enable direct I/O port and I2C sensor reading (requires root)]' \
'--show-empty[Show empty/unavailable fields]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_sio__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:sio-help-command-$line[1]:"
        case $line[1] in
            (cpu)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(gpu)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(memory)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(storage)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(network)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(pci)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(usb)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(audio)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(battery)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(board)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(pcie)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(sensors)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_sio_commands] )) ||
_sio_commands() {
    local commands; commands=(
'cpu:CPU information' \
'gpu:GPU information' \
'memory:Memory information' \
'storage:Storage device information' \
'network:Network adapter information' \
'pci:PCI device list' \
'usb:USB device list' \
'audio:Audio device information' \
'battery:Battery information' \
'board:Motherboard and BIOS information' \
'pcie:PCIe link details (speed, width, ASPM)' \
'sensors:Sensor readings (one-shot snapshot)' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'sio commands' commands "$@"
}
(( $+functions[_sio__audio_commands] )) ||
_sio__audio_commands() {
    local commands; commands=()
    _describe -t commands 'sio audio commands' commands "$@"
}
(( $+functions[_sio__battery_commands] )) ||
_sio__battery_commands() {
    local commands; commands=()
    _describe -t commands 'sio battery commands' commands "$@"
}
(( $+functions[_sio__board_commands] )) ||
_sio__board_commands() {
    local commands; commands=()
    _describe -t commands 'sio board commands' commands "$@"
}
(( $+functions[_sio__cpu_commands] )) ||
_sio__cpu_commands() {
    local commands; commands=()
    _describe -t commands 'sio cpu commands' commands "$@"
}
(( $+functions[_sio__gpu_commands] )) ||
_sio__gpu_commands() {
    local commands; commands=()
    _describe -t commands 'sio gpu commands' commands "$@"
}
(( $+functions[_sio__help_commands] )) ||
_sio__help_commands() {
    local commands; commands=(
'cpu:CPU information' \
'gpu:GPU information' \
'memory:Memory information' \
'storage:Storage device information' \
'network:Network adapter information' \
'pci:PCI device list' \
'usb:USB device list' \
'audio:Audio device information' \
'battery:Battery information' \
'board:Motherboard and BIOS information' \
'pcie:PCIe link details (speed, width, ASPM)' \
'sensors:Sensor readings (one-shot snapshot)' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'sio help commands' commands "$@"
}
(( $+functions[_sio__help__audio_commands] )) ||
_sio__help__audio_commands() {
    local commands; commands=()
    _describe -t commands 'sio help audio commands' commands "$@"
}
(( $+functions[_sio__help__battery_commands] )) ||
_sio__help__battery_commands() {
    local commands; commands=()
    _describe -t commands 'sio help battery commands' commands "$@"
}
(( $+functions[_sio__help__board_commands] )) ||
_sio__help__board_commands() {
    local commands; commands=()
    _describe -t commands 'sio help board commands' commands "$@"
}
(( $+functions[_sio__help__cpu_commands] )) ||
_sio__help__cpu_commands() {
    local commands; commands=()
    _describe -t commands 'sio help cpu commands' commands "$@"
}
(( $+functions[_sio__help__gpu_commands] )) ||
_sio__help__gpu_commands() {
    local commands; commands=()
    _describe -t commands 'sio help gpu commands' commands "$@"
}
(( $+functions[_sio__help__help_commands] )) ||
_sio__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'sio help help commands' commands "$@"
}
(( $+functions[_sio__help__memory_commands] )) ||
_sio__help__memory_commands() {
    local commands; commands=()
    _describe -t commands 'sio help memory commands' commands "$@"
}
(( $+functions[_sio__help__network_commands] )) ||
_sio__help__network_commands() {
    local commands; commands=()
    _describe -t commands 'sio help network commands' commands "$@"
}
(( $+functions[_sio__help__pci_commands] )) ||
_sio__help__pci_commands() {
    local commands; commands=()
    _describe -t commands 'sio help pci commands' commands "$@"
}
(( $+functions[_sio__help__pcie_commands] )) ||
_sio__help__pcie_commands() {
    local commands; commands=()
    _describe -t commands 'sio help pcie commands' commands "$@"
}
(( $+functions[_sio__help__sensors_commands] )) ||
_sio__help__sensors_commands() {
    local commands; commands=()
    _describe -t commands 'sio help sensors commands' commands "$@"
}
(( $+functions[_sio__help__storage_commands] )) ||
_sio__help__storage_commands() {
    local commands; commands=()
    _describe -t commands 'sio help storage commands' commands "$@"
}
(( $+functions[_sio__help__usb_commands] )) ||
_sio__help__usb_commands() {
    local commands; commands=()
    _describe -t commands 'sio help usb commands' commands "$@"
}
(( $+functions[_sio__memory_commands] )) ||
_sio__memory_commands() {
    local commands; commands=()
    _describe -t commands 'sio memory commands' commands "$@"
}
(( $+functions[_sio__network_commands] )) ||
_sio__network_commands() {
    local commands; commands=()
    _describe -t commands 'sio network commands' commands "$@"
}
(( $+functions[_sio__pci_commands] )) ||
_sio__pci_commands() {
    local commands; commands=()
    _describe -t commands 'sio pci commands' commands "$@"
}
(( $+functions[_sio__pcie_commands] )) ||
_sio__pcie_commands() {
    local commands; commands=()
    _describe -t commands 'sio pcie commands' commands "$@"
}
(( $+functions[_sio__sensors_commands] )) ||
_sio__sensors_commands() {
    local commands; commands=()
    _describe -t commands 'sio sensors commands' commands "$@"
}
(( $+functions[_sio__storage_commands] )) ||
_sio__storage_commands() {
    local commands; commands=()
    _describe -t commands 'sio storage commands' commands "$@"
}
(( $+functions[_sio__usb_commands] )) ||
_sio__usb_commands() {
    local commands; commands=()
    _describe -t commands 'sio usb commands' commands "$@"
}

if [ "$funcstack[1]" = "_sio" ]; then
    _sio "$@"
else
    compdef _sio sio
fi
