#compdef linux-updater _linux_updater() { local context state state_descr line typeset -A opt_args local -a common_args common_args=( '(-c --config)'{-c,--config}'[Path to JSON configuration file]:config file:_files -g "*.json"' '(-y --yes --non-interactive)'{-y,--yes,--non-interactive}'[Run without interactive confirmation prompts]' '--dry-run[Simulate execution without modifying system state]' '--no-remediation[Disable automatic remediation of failed health checks]' '--skip-preflight[Skip pre-flight health checks]' '--json[Output structured JSON results]' '--reboot[Automatically reboot the system after upgrade or if required]' '(-h --help)'{-h,--help}'[Show help message and exit]' ) _arguments -C \ '(-v --version)'{-v,--version}'[Show program version and exit]' \ $common_args \ '1: :->command' \ '*:: :->args' case $state in command) local -a commands commands=( 'update:Inspect health, auto-remediate safe issues, and apply package updates' 'check:Check system health and list available updates without making modifications' 'release-upgrade:Perform a major distribution release upgrade with safety checks' 'clean:Clean downloaded package cache and remove orphaned packages' 'health:Run only the pre-flight health diagnostic checks' 'completion:Generate shell autocompletion script (bash or zsh)' ) _describe -t commands 'subcommand' commands ;; args) case $line[1] in update) _arguments \ $common_args \ '--packages[Selectively update specified package(s)]:package: ' \ '--exclude[Exclude package(s) or glob patterns from update]:exclude: ' \ '--security[Apply only security-related updates]' \ '--flatpak[Update Flatpak packages if available]' ;; check) _arguments \ $common_args ;; release-upgrade) _arguments \ $common_args \ '(-t --target-release --releasever)'{-t,--target-release,--releasever}'[Specify target distribution version number/codename]:target release: ' ;; clean) _arguments \ $common_args \ '--all[Clean both package cache and autoremove unused dependencies]' ;; health) _arguments \ $common_args ;; completion) local -a shells shells=('bash:Generate Bash completion script' 'zsh:Generate Zsh completion script') _describe -t shells 'shell' shells ;; esac ;; esac } _linux_updater "$@"