From 6b7003c3efcabe5ce185d5c2a1a8b708d92dfb82 Mon Sep 17 00:00:00 2001 From: Laurent Commarieu Date: Mon, 26 Sep 2016 15:26:38 +0200 Subject: [PATCH] feat(plugin): add nomad --- plugins/nomad/README.md | 11 +++++++++ plugins/nomad/_nomad | 51 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 plugins/nomad/README.md create mode 100644 plugins/nomad/_nomad diff --git a/plugins/nomad/README.md b/plugins/nomad/README.md new file mode 100644 index 00000000..ff07e917 --- /dev/null +++ b/plugins/nomad/README.md @@ -0,0 +1,11 @@ +## About + +Plugin for Nomad, a tool from Hashicorp for easily deploy applications at any scale. + +### Requirements + + * [Nomad](https://nomadproject.io/) + +### Usage + + * Type `nomad` into your prompt and hit `TAB` to see available completion options diff --git a/plugins/nomad/_nomad b/plugins/nomad/_nomad new file mode 100644 index 00000000..25169f39 --- /dev/null +++ b/plugins/nomad/_nomad @@ -0,0 +1,51 @@ +#compdef nomad + +local -a _nomad_cmds +_nomad_cmds=( + 'agent:Runs a Nomad agent' + 'agent-info:Display status information about the local agent' + 'alloc-status:Display allocation status information and metadata' + 'client-config:View or modify client configuration details' + 'eval-status:Display evaluation status and placement failure reasons' + 'fs:Inspect the contents of an allocation directory' + 'init:Create an example job file' + 'inspect:Inspect a submitted job' + 'logs:Streams the logs of a task.' + 'node-drain:Toggle drain mode on a given node' + 'node-status:Display status information about nodes' + 'plan:Dry-run a job update to determine its effects' + 'run:Run a new job or update an existing' + 'server-force-leave:Force a server into the left state' + 'server-join:Join server nodes together' + 'server-members:Display a list of known servers and their' + 'status:Display status information about jobs' + 'stop:Stop a running job' + 'validate:Checks if a given job specification is valid' + 'version:Prints the Nomad version' +) + + +__allocstatus() { + _arguments \ + '-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \ + '-region=[(region) The region of the Nomad servers to forward commands to. Overrides the NOMAD_REGION environment variable if set. Defaults to the Agent s local region.]' \ + '-no-color[Disables colored command output.]' \ + '-short[Display short output. Shows only the most recent task event.]' \ + '-stats[Display detailed resource usage statistics.]' \ + '-verbose[Show full information.]' \ + '-json[Output the allocation in its JSON format.]' \ + '-t[Format and display allocation using a Go template.]' +} + +_arguments '*:: :->command' + +if (( CURRENT == 1 )); then + _describe -t commands "nomad command" _nomad_cmds + return +fi + +local -a _command_args +case "$words[1]" in + alloc-status) + __allocstatus ;; +esac