#compdef switcheroo autoload -U is-at-least _switcheroo() { 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[@]}" : \ '*-v[Increase logging verbosity]' \ '*--verbose[Increase logging verbosity]' \ '(-v --verbose)*-q[Decrease logging verbosity]' \ '(-v --verbose)*--quiet[Decrease logging verbosity]' \ '-h[Print help]' \ '--help[Print help]' \ '-V[Print version]' \ '--version[Print version]' \ ":: :_switcheroo_commands" \ "*::: :->switcheroo" \ && ret=0 case $state in (switcheroo) words=($line[1] "${words[@]}") (( CURRENT += 1 )) curcontext="${curcontext%:*:*}:switcheroo-command-$line[1]:" case $line[1] in (execute) _arguments "${_arguments_options[@]}" : \ '-f+[Use a favorite payload instead]:FAVORITE: ' \ '--favorite=[Use a favorite payload instead]:FAVORITE: ' \ '-w[Wait for device to be connected]' \ '--wait[Wait for device to be connected]' \ '*-v[Increase logging verbosity]' \ '*--verbose[Increase logging verbosity]' \ '(-v --verbose)*-q[Decrease logging verbosity]' \ '(-v --verbose)*--quiet[Decrease logging verbosity]' \ '-h[Print help]' \ '--help[Print help]' \ '::payload -- Path to the payload file:_files' \ && ret=0 ;; (device) _arguments "${_arguments_options[@]}" : \ '-w[Wait for device to be connected]' \ '--wait[Wait for device to be connected]' \ '*-v[Increase logging verbosity]' \ '*--verbose[Increase logging verbosity]' \ '(-v --verbose)*-q[Decrease logging verbosity]' \ '(-v --verbose)*--quiet[Decrease logging verbosity]' \ '-h[Print help]' \ '--help[Print help]' \ && ret=0 ;; (list) _arguments "${_arguments_options[@]}" : \ '*-v[Increase logging verbosity]' \ '*--verbose[Increase logging verbosity]' \ '(-v --verbose)*-q[Decrease logging verbosity]' \ '(-v --verbose)*--quiet[Decrease logging verbosity]' \ '-h[Print help]' \ '--help[Print help]' \ && ret=0 ;; (add) _arguments "${_arguments_options[@]}" : \ '*-v[Increase logging verbosity]' \ '*--verbose[Increase logging verbosity]' \ '(-v --verbose)*-q[Decrease logging verbosity]' \ '(-v --verbose)*--quiet[Decrease logging verbosity]' \ '-h[Print help]' \ '--help[Print help]' \ ':payload -- Path to the binary file:_files' \ && ret=0 ;; (remove) _arguments "${_arguments_options[@]}" : \ '*-v[Increase logging verbosity]' \ '*--verbose[Increase logging verbosity]' \ '(-v --verbose)*-q[Decrease logging verbosity]' \ '(-v --verbose)*--quiet[Decrease logging verbosity]' \ '-h[Print help]' \ '--help[Print help]' \ ':favorite:' \ && ret=0 ;; (gui) _arguments "${_arguments_options[@]}" : \ '*-v[Increase logging verbosity]' \ '*--verbose[Increase logging verbosity]' \ '(-v --verbose)*-q[Decrease logging verbosity]' \ '(-v --verbose)*--quiet[Decrease logging verbosity]' \ '-h[Print help]' \ '--help[Print help]' \ && ret=0 ;; (help) _arguments "${_arguments_options[@]}" : \ ":: :_switcheroo__help_commands" \ "*::: :->help" \ && ret=0 case $state in (help) words=($line[1] "${words[@]}") (( CURRENT += 1 )) curcontext="${curcontext%:*:*}:switcheroo-help-command-$line[1]:" case $line[1] in (execute) _arguments "${_arguments_options[@]}" : \ && ret=0 ;; (device) _arguments "${_arguments_options[@]}" : \ && ret=0 ;; (list) _arguments "${_arguments_options[@]}" : \ && ret=0 ;; (add) _arguments "${_arguments_options[@]}" : \ && ret=0 ;; (remove) _arguments "${_arguments_options[@]}" : \ && ret=0 ;; (gui) _arguments "${_arguments_options[@]}" : \ && ret=0 ;; (help) _arguments "${_arguments_options[@]}" : \ && ret=0 ;; esac ;; esac ;; esac ;; esac } (( $+functions[_switcheroo_commands] )) || _switcheroo_commands() { local commands; commands=( 'execute:Executes a payload on a connected Switch' \ 'device:Checks if a Switch is connected and booted to RCM mode' \ 'list:Lists favorite binaries' \ 'add:Add a favorite binary' \ 'remove:Remove a favorite binary' \ 'gui:Opens the graphical user interface' \ 'help:Print this message or the help of the given subcommand(s)' \ ) _describe -t commands 'switcheroo commands' commands "$@" } (( $+functions[_switcheroo__add_commands] )) || _switcheroo__add_commands() { local commands; commands=() _describe -t commands 'switcheroo add commands' commands "$@" } (( $+functions[_switcheroo__device_commands] )) || _switcheroo__device_commands() { local commands; commands=() _describe -t commands 'switcheroo device commands' commands "$@" } (( $+functions[_switcheroo__execute_commands] )) || _switcheroo__execute_commands() { local commands; commands=() _describe -t commands 'switcheroo execute commands' commands "$@" } (( $+functions[_switcheroo__gui_commands] )) || _switcheroo__gui_commands() { local commands; commands=() _describe -t commands 'switcheroo gui commands' commands "$@" } (( $+functions[_switcheroo__help_commands] )) || _switcheroo__help_commands() { local commands; commands=( 'execute:Executes a payload on a connected Switch' \ 'device:Checks if a Switch is connected and booted to RCM mode' \ 'list:Lists favorite binaries' \ 'add:Add a favorite binary' \ 'remove:Remove a favorite binary' \ 'gui:Opens the graphical user interface' \ 'help:Print this message or the help of the given subcommand(s)' \ ) _describe -t commands 'switcheroo help commands' commands "$@" } (( $+functions[_switcheroo__help__add_commands] )) || _switcheroo__help__add_commands() { local commands; commands=() _describe -t commands 'switcheroo help add commands' commands "$@" } (( $+functions[_switcheroo__help__device_commands] )) || _switcheroo__help__device_commands() { local commands; commands=() _describe -t commands 'switcheroo help device commands' commands "$@" } (( $+functions[_switcheroo__help__execute_commands] )) || _switcheroo__help__execute_commands() { local commands; commands=() _describe -t commands 'switcheroo help execute commands' commands "$@" } (( $+functions[_switcheroo__help__gui_commands] )) || _switcheroo__help__gui_commands() { local commands; commands=() _describe -t commands 'switcheroo help gui commands' commands "$@" } (( $+functions[_switcheroo__help__help_commands] )) || _switcheroo__help__help_commands() { local commands; commands=() _describe -t commands 'switcheroo help help commands' commands "$@" } (( $+functions[_switcheroo__help__list_commands] )) || _switcheroo__help__list_commands() { local commands; commands=() _describe -t commands 'switcheroo help list commands' commands "$@" } (( $+functions[_switcheroo__help__remove_commands] )) || _switcheroo__help__remove_commands() { local commands; commands=() _describe -t commands 'switcheroo help remove commands' commands "$@" } (( $+functions[_switcheroo__list_commands] )) || _switcheroo__list_commands() { local commands; commands=() _describe -t commands 'switcheroo list commands' commands "$@" } (( $+functions[_switcheroo__remove_commands] )) || _switcheroo__remove_commands() { local commands; commands=() _describe -t commands 'switcheroo remove commands' commands "$@" } if [ "$funcstack[1]" = "_switcheroo" ]; then _switcheroo "$@" else compdef _switcheroo switcheroo fi