6b7003c3efcabe5ce185d5c2a1a8b708d92dfb82

Author
Laurent Commarieu <laurent.commarieu@iadvize.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

feat(plugin): add nomad

Diff

 1diff --git a/plugins/nomad/README.md b/plugins/nomad/README.md
 2new file mode 100644
 3index 0000000000000000000000000000000000000000..ff07e917be093d485a92957df647c6d8bb7ceea6
 4--- /dev/null
 5+++ b/plugins/nomad/README.md
 6@@ -0,0 +1,11 @@
 7+## About
 8+
 9+Plugin for Nomad, a tool from Hashicorp for easily deploy applications at any scale.
10+
11+### Requirements
12+
13+ * [Nomad](https://nomadproject.io/)
14+
15+### Usage
16+
17+ * Type `nomad` into your prompt and hit `TAB` to see available completion options
18diff --git a/plugins/nomad/_nomad b/plugins/nomad/_nomad
19new file mode 100644
20index 0000000000000000000000000000000000000000..25169f394eddf2c707753912aa712d4c8729e01a
21--- /dev/null
22+++ b/plugins/nomad/_nomad
23@@ -0,0 +1,51 @@
24+#compdef nomad
25+
26+local -a _nomad_cmds
27+_nomad_cmds=(
28+  'agent:Runs a Nomad agent'
29+  'agent-info:Display status information about the local agent'
30+  'alloc-status:Display allocation status information and metadata'
31+  'client-config:View or modify client configuration details'
32+  'eval-status:Display evaluation status and placement failure reasons'
33+  'fs:Inspect the contents of an allocation directory'
34+  'init:Create an example job file'
35+  'inspect:Inspect a submitted job'
36+  'logs:Streams the logs of a task.'
37+  'node-drain:Toggle drain mode on a given node'
38+  'node-status:Display status information about nodes'
39+  'plan:Dry-run a job update to determine its effects'
40+  'run:Run a new job or update an existing'
41+  'server-force-leave:Force a server into the left state'
42+  'server-join:Join server nodes together'
43+  'server-members:Display a list of known servers and their'
44+  'status:Display status information about jobs'
45+  'stop:Stop a running job'
46+  'validate:Checks if a given job specification is valid'
47+  'version:Prints the Nomad version'
48+)
49+
50+
51+__allocstatus() {
52+  _arguments \
53+    '-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \
54+    '-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.]' \
55+    '-no-color[Disables colored command output.]' \
56+    '-short[Display short output. Shows only the most recent task event.]' \
57+    '-stats[Display detailed resource usage statistics.]' \
58+    '-verbose[Show full information.]' \
59+    '-json[Output the allocation in its JSON format.]' \
60+    '-t[Format and display allocation using a Go template.]'
61+}
62+
63+_arguments '*:: :->command'
64+
65+if (( CURRENT == 1 )); then
66+  _describe -t commands "nomad command" _nomad_cmds
67+  return
68+fi
69+
70+local -a _command_args
71+case "$words[1]" in
72+  alloc-status)
73+    __allocstatus ;;
74+esac