_nomad 1.92 KB
Newer Older
Laurent Commarieu's avatar
Laurent Commarieu committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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