#compdef rundeck local expl local ret=1 _rundeck() { typeset -A opt_args local ret=1 local context curcontext="$curcontext" state line _arguments -s -S -C \ "-h[Prints help information]" \ "--help[Prints help information]" \ "1:: :_rundeck_commands" \ "*:: :->rundeck" \ && ret=0 case $state in (rundeck) curcontext="${curcontext%:*:*}:rustup-command-$words[1]:" case $line[1] in (list) _arguments -s -S -C \ "-h[base Prints help information]" \ "--help[base Prints help information]" \ "1:: :_rundeck_list_commands" \ "*:: :->list" \ && ret=0 case $state in (list) curcontext="${curcontext%:*:*}:rundeck-list-command-$words[1]:" case $line[1] in (jobs) _arguments -s -S -C \ "-h[Prints help information]" \ "--help[Prints help information]" \ "1:: :_rundeck_list_jobs_commands" \ && ret=0 ;; (projects) _arguments -s -S -C \ "-h[Prints help information]" \ "--help[Prints help information]" \ && ret=0 ;; (executions) _arguments -s -S -C \ "-h[Prints help information]" \ "--help[Prints help information]" \ "1:: :_rundeck_list_executions_commands" \ "*:: :->executions" \ && ret=0 case $state in (executions) curcontext="${curcontext%:*:*}:rundeck-list-execution-command-$words[1]:" case $line[1] in (project) _arguments -s -S -C \ "-h[Prints help information]" \ "--help[Prints help information]" \ "1:: :_rundeck_list_executions_project_commands" \ && ret=0 ;; esac ;; esac ;; (help) _arguments -s -S -C \ "-h[Prints help information]" \ "--help[Prints help information]" \ && ret=0 ;; esac ;; esac ;; (run) _arguments -s -S -C \ "-h[base Prints help information]" \ "--help[base Prints help information]" \ "1:: :_rundeck_run_commands" \ "2:: :_rundeck_run_job_id_commands" \ && ret=0 ;; esac ;; esac } (( $+functions[_rundeck_commands] )) || _rundeck_commands() { local commands; commands=( "list:List projects, jobs and executions" \ "run:Run a job" \ "install:Update Rust toolchains" \ "help:Prints this message or the help of the given subcommand(s)" \ ) _describe -t commands 'rundeck commands' commands "$@" } (( $+functions[_rundeck_list_commands] )) || _rundeck_list_commands() { local commands; commands=( "projects:List project" \ "jobs:List jobs." \ "executions:List executions." \ "help:Prints this message or the help of the given subcommand(s)" \ ) _describe -t commands 'rundeck list commands' commands "$@" } (( $+functions[_rundeck_list_jobs_commands] )) || _rundeck_list_jobs_commands() { local commands; commands=($(rundeck list projects -q)) _describe -t commands 'rundeck list jobs commands' commands "$@" } (( $+functions[_rundeck_list_executions_project_commands] )) || _rundeck_list_executions_project_commands() { local commands; commands=($(rundeck list projects -q)) _describe -t commands 'rundeck list executons project commands' commands "$@" } (( $+functions[_rundeck_run_commands] )) || _rundeck_run_commands() { local commands; commands=($(rundeck list projects -q)) _describe -t commands 'rundeck run commands' commands "$@" } (( $+functions[_rundeck_run_job_id_commands] )) || _rundeck_run_job_id_commands() { local commands; commands=($(rundeck list jobs $words[2] -q -c)) _describe -t commands 'rundeck run commands' commands "$@" } (( $+functions[_rundeck_list_executions_commands] )) || _rundeck_list_executions_commands() { local commands; commands=( "project:Display executions for a project" \ "job:Display executions for a job" \ "help:Prints this message or the help of the given subcommand(s)" \ ) _describe -t commands 'rundeck list executions commands' commands "$@" } _rundeck "$@"