diff options
| author | Remi Paulmier <remi.paulmier@gmail.com> | 2015-06-11 18:42:11 +0200 |
|---|---|---|
| committer | Remi Paulmier <remi.paulmier@gmail.com> | 2015-06-11 18:42:11 +0200 |
| commit | 044c4018d1e2fc57e8f82fe0c353ac7222d45bf8 (patch) | |
| tree | 31e12c6113f08c42aff87f7c489ea91bed0509cd /src/_fleetctl | |
| parent | Merge pull request #324 from syohex/misspellings (diff) | |
| download | zsh-completions-044c4018d1e2fc57e8f82fe0c353ac7222d45bf8.tar zsh-completions-044c4018d1e2fc57e8f82fe0c353ac7222d45bf8.tar.gz zsh-completions-044c4018d1e2fc57e8f82fe0c353ac7222d45bf8.tar.bz2 zsh-completions-044c4018d1e2fc57e8f82fe0c353ac7222d45bf8.tar.lz zsh-completions-044c4018d1e2fc57e8f82fe0c353ac7222d45bf8.tar.xz zsh-completions-044c4018d1e2fc57e8f82fe0c353ac7222d45bf8.tar.zst zsh-completions-044c4018d1e2fc57e8f82fe0c353ac7222d45bf8.zip | |
a first version a completion file for fleetctl
Diffstat (limited to 'src/_fleetctl')
| -rw-r--r-- | src/_fleetctl | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/src/_fleetctl b/src/_fleetctl new file mode 100644 index 0000000..fd5f44e --- /dev/null +++ b/src/_fleetctl @@ -0,0 +1,102 @@ +#compdef fleetctl +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for fleetctl (https://github.com/coreos/fleet). +# +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Remi Paulmier (https://github.com/shtouff) +# +# ------------------------------------------------------------------------------ + +# fleetctl zsh completion + +local -a _1st_arguments +_1st_arguments=( + 'cat:Output the contents of a submitted unit' + 'destroy:Destroy one or more units in the cluster' + 'fd-forward:Proxy stdin and stdout to a unix domain socket' + 'help:Show a list of commands or help for one command' + 'journal:Print the journal of a unit in the cluster to stdout' + 'list-machines:Enumerate the current hosts in the cluster' + 'list-unit-files:List the units that exist in the cluster.' + 'list-units:List the current state of units in the cluster' + 'load:Schedule one or more units in the cluster, first submitting them if necessary.' + 'ssh:Open interactive shell on a machine in the cluster' + 'start:Instruct systemd to start one or more units in the cluster, first submitting and loading if necessary.' + 'status:Output the status of one or more units in the cluster' + 'stop:Instruct systemd to stop one or more units in the cluster.' + 'submit:Upload one or more units to the cluster without starting them' + 'unload:Unschedule one or more units in the cluster.' + 'version:Print the version and exit' +) + +__task_list () +{ + local expl + declare -a tasks + + tasks=(cat destroy fd-forward help journal list-machines list-unit-files \ + list-units load ssh start status stop submit unload version) + + _wanted tasks expl 'help' compadd $tasks +} + +__unit_list () +{ + _wanted application expl 'command' compadd $(command fleetctl list-units | \ + tail -n +2 | awk '{print $1}') +} + +local expl + +local curcontext="$curcontext" state line +local -A opt_args + +_arguments -C \ + ':command:->command' \ + '*::options:->options' + +case $state in + (command) + _describe -t commands "gem subcommand" _1st_arguments + return + ;; + + (options) + case $line[1] in + (help) + _arguments ':feature:__task_list' + ;; + + (destroy|journal|start|status|stop|unload|cat) + _arguments '*:feature:__unit_list' + ;; + + (load|submit) + _arguments '*:file:_files -g *.service' + ;; + + (ssh) + _arguments '*:host:_hosts' + ;; + + (*) + _arguments '*:file:_files' + ;; + esac + ;; +esac + +# Local Variables: +# mode: Shell-Script +# sh-indentation: 2 +# indent-tabs-mode: nil +# sh-basic-offset: 2 +# End: +# vim: ft=zsh sw=2 ts=2 et |
