2019-06-06 19:18:45 +00:00
|
|
|
# New CLI command
|
|
|
|
|
|
|
|
Subcommands should always be preferred over adding more top-level commands.
|
|
|
|
|
|
|
|
Code flow for commands is generally:
|
|
|
|
|
|
|
|
```
|
|
|
|
CLI (command/) -> API Client (api/) -> HTTP API (command/agent) -> RPC (nomad/)
|
|
|
|
```
|
|
|
|
|
|
|
|
## Code
|
|
|
|
|
2020-02-12 16:07:07 +00:00
|
|
|
* [ ] Consider similar commands in Consul, Vault, and other tools. Is there
|
|
|
|
prior art we should match? Arguments, flags, env vars, etc?
|
|
|
|
* [ ] New file in `command/` or in an existing file if a subcommand
|
2023-02-07 14:46:27 +00:00
|
|
|
* [ ] For nested commands make sure all intermediary subcommands exist (for
|
|
|
|
example, `nomad acl`, `nomad acl policy`, and `nomad acl policy apply` must
|
|
|
|
all be valid commands)
|
2020-02-12 16:07:07 +00:00
|
|
|
* [ ] Test new command in `command/` package
|
|
|
|
* [ ] Implement autocomplete
|
|
|
|
* [ ] Implement `-json` (returns raw API response)
|
2023-02-07 14:46:27 +00:00
|
|
|
* [ ] Implement `-t` (format API response using gotemplate)
|
2020-02-12 16:07:07 +00:00
|
|
|
* [ ] Implement `-verbose` (expands truncated UUIDs, adds other detail)
|
|
|
|
* [ ] Update help text
|
2023-02-07 14:46:27 +00:00
|
|
|
* [ ] Register new command in `command/commands.go`
|
|
|
|
* [ ] If the command has a `status` subcommand consider adding a search context
|
|
|
|
in `nomad/search_endpoint.go` and update `command/status.go`
|
2020-02-12 16:07:07 +00:00
|
|
|
* [ ] Implement and test new HTTP endpoint in `command/agent/<command>_endpoint.go`
|
2020-01-02 19:47:26 +00:00
|
|
|
* [ ] Register new URL paths in `command/agent/http.go`
|
2020-02-12 16:07:07 +00:00
|
|
|
* [ ] Implement and test new RPC endpoint in `nomad/<command>_endpoint.go`
|
|
|
|
* [ ] Implement and test new Client RPC endpoint in
|
|
|
|
`client/<command>_endpoint.go` (For client endpoints like Filesystem only)
|
2019-06-12 22:35:48 +00:00
|
|
|
* [ ] Implement and test new `api/` package Request and Response structs
|
|
|
|
* [ ] Implement and test new `api/` package helper methods
|
|
|
|
* [ ] Implement and test new `nomad/structs/` package Request and Response structs
|
2019-06-06 19:18:45 +00:00
|
|
|
|
|
|
|
## Docs
|
|
|
|
|
2019-06-12 22:35:48 +00:00
|
|
|
* [ ] Changelog
|
2020-06-25 17:48:27 +00:00
|
|
|
* [ ] API docs https://www.nomadproject.io/api
|
|
|
|
* [ ] CLI docs https://www.nomadproject.io/docs/commands
|
|
|
|
* [ ] If adding new docs see [website README](../website/README.md#editing-navigation-sidebars)
|
2019-06-12 22:35:48 +00:00
|
|
|
* [ ] Consider if it needs a guide https://www.nomadproject.io/guides/index.html
|