Parent directory

_nomad

8101 bytes
  1#compdef nomad
  2
  3local -a _nomad_cmds
  4_nomad_cmds=(
  5  'agent:Runs a Nomad agent'
  6  'agent-info:Display status information about the local agent'
  7  'alloc-status:Display allocation status information and metadata'
  8  'client-config:View or modify client configuration details'
  9  'eval-status:Display evaluation status and placement failure reasons'
 10  'fs:Inspect the contents of an allocation directory'
 11  'init:Create an example job file'
 12  'inspect:Inspect a submitted job'
 13  'logs:Streams the logs of a task.'
 14  'node-drain:Toggle drain mode on a given node'
 15  'node-status:Display status information about nodes'
 16  'plan:Dry-run a job update to determine its effects'
 17  'run:Run a new job or update an existing'
 18  'server-force-leave:Force a server into the left state'
 19  'server-join:Join server nodes together'
 20  'server-members:Display a list of known servers and their'
 21  'status:Display status information about jobs'
 22  'stop:Stop a running job'
 23  'validate:Checks if a given job specification is valid'
 24  'version:Prints the Nomad version'
 25)
 26
 27__allocstatus() {
 28  _arguments \
 29    '-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \
 30    '-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.]' \
 31    '-no-color[Disables colored command output.]' \
 32    '-short[Display short output. Shows only the most recent task event.]' \
 33    '-stats[Display detailed resource usage statistics.]' \
 34    '-verbose[Show full information.]' \
 35    '-json[Output the allocation in its JSON format.]' \
 36    '-t[Format and display allocation using a Go template.]'
 37}
 38
 39__evalstatus() {
 40  _arguments \
 41    '-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \
 42    '-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.]' \
 43    '-no-color[Disables colored command output.]' \
 44    '-monitor[Monitor an outstanding evaluation.]' \
 45    '-verbose[Show full information.]' \
 46    '-json[Output the allocation in its JSON format.]' \
 47    '-t[Format and display allocation using a Go template.]'
 48}
 49
 50__inspect() {
 51  _arguments \
 52    '-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \
 53    '-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.]' \
 54    '-no-color[Disables colored command output.]' \
 55    '-json[Output the allocation in its JSON format.]' \
 56    '-t[Format and display allocation using a Go template.]'
 57}
 58
 59__logs() {
 60  _arguments \
 61    '-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \
 62    '-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.]' \
 63    '-no-color[Disables colored command output.]' \
 64    '-stderr[ Display stderr logs.]' \
 65    '-job[<job-id> Use a random allocation from the specified job ID.]' \
 66    '-verbose[Show full information.]' \
 67    '-f[Causes the output to not stop when the end of the logs are reached, but rather to wait for additional output.]' \
 68    '-tail[Show the logs contents with offsets relative to the end of the logs. If no offset is given, -n is defaulted to 10.]' \
 69    '-n[Sets the tail location in best-efforted number of lines relative to the end of the logs.]' \
 70    '-c[Sets the tail location in number of bytes relative to the end of the logs.]'
 71}
 72
 73__nodestatus() {
 74  _arguments \
 75    '-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \
 76    '-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.]' \
 77    '-no-color[Disables colored command output.]' \
 78    '-self[Query the status of the local node.]' \
 79    '-allocs[ Display a count of running allocations for each node.]' \
 80    '-short[Display short output. Shows only the most recent task event.]' \
 81    '-stats[Display detailed resource usage statistics.]' \
 82    '-verbose[Show full information.]' \
 83    '-json[Output the allocation in its JSON format.]' \
 84    '-t[Format and display allocation using a Go template.]'
 85}
 86
 87__plan() {
 88  _arguments \
 89    '-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \
 90    '-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.]' \
 91    '-no-color[Disables colored command output.]' \
 92    '-diff[Determines whether the diff between the remote job and planned job is shown. Defaults to true.]'
 93}
 94
 95__run() {
 96  _arguments \
 97    '-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \
 98    '-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.]' \
 99    '-no-color[Disables colored command output.]' \
100    '-check-index[If set, the job is only registered or updated if the passed job modify index matches the server side version. If a check-index value of zero is passed, the job is only registered if it does not yet exist. If a non-zero value is passed, it ensures that the job is being updated from a known state. The use of this flag is most common in conjunction with plan command.]' \
101    '-detach[Return immediately instead of entering monitor mode. After job submission, the evaluation ID will be printed to the screen, which can be used to examine the evaluation using the eval-status command.]' \
102    '-output[Output the JSON that would be submitted to the HTTP API without submitting the job.]' \
103    '-verbose[Show full information.]'
104}
105
106__status() {
107  _arguments \
108    '-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \
109    '-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.]' \
110    '-no-color[Disables colored command output.]' \
111    '-short[Display short output. Shows only the most recent task event.]' \
112    '-evals[Display the evaluations associated with the job.]' \
113    '-verbose[Show full information.]'
114}
115
116__stop() {
117  _arguments \
118    '-address=[(addr) The address of the Nomad server. Overrides the NOMAD_ADDR environment variable if set. Default = http://127.0.0.1:4646]' \
119    '-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.]' \
120    '-no-color[Disables colored command output.]' \
121    '-detach[Return immediately instead of entering monitor mode. After the deregister command is submitted, a new evaluation ID is printed to the screen, which can be used to examine the evaluation using the eval-status command.]' \
122    '-yes[Automatic yes to prompts.]' \
123    '-verbose[Show full information.]'
124}
125
126_arguments '*:: :->command'
127
128if (( CURRENT == 1 )); then
129  _describe -t commands "nomad command" _nomad_cmds
130  return
131fi
132
133local -a _command_args
134case "$words[1]" in
135  alloc-status)
136    __allocstatus ;;
137  eval-status)
138    __evalstatus ;;
139  inspect)
140    __inspect ;;
141  logs)
142    __logs ;;
143  node-status)
144    __nodestatus ;;
145  plan)
146    __plan ;;
147  run)
148    __run ;;
149  status)
150    __status ;;
151  stop)
152    __stop ;;
153esac