github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/contributing/checklist-command.md (about)

     1  # New CLI command
     2  
     3  Subcommands should always be preferred over adding more top-level commands.
     4  
     5  Code flow for commands is generally:
     6  
     7  ```
     8  CLI (command/) -> API Client (api/) -> HTTP API (command/agent) -> RPC (nomad/)
     9  ```
    10  
    11  ## Code
    12  
    13  * [ ] Consider similar commands in Consul, Vault, and other tools. Is there
    14    prior art we should match? Arguments, flags, env vars, etc?
    15  * [ ] New file in `command/` or in an existing file if a subcommand
    16  * [ ] Test new command in `command/` package
    17  * [ ] Implement autocomplete
    18  * [ ] Implement `-json` (returns raw API response)
    19  * [ ] Implement `-verbose` (expands truncated UUIDs, adds other detail)
    20  * [ ] Update help text
    21  * [ ] Implement and test new HTTP endpoint in `command/agent/<command>_endpoint.go`
    22  * [ ] Register new URL paths in `command/agent/http.go`
    23  * [ ] Implement and test new RPC endpoint in `nomad/<command>_endpoint.go`
    24  * [ ] Implement and test new Client RPC endpoint in
    25    `client/<command>_endpoint.go` (For client endpoints like Filesystem only)
    26  * [ ] Implement and test new `api/` package Request and Response structs
    27  * [ ] Implement and test new `api/` package helper methods
    28  * [ ] Implement and test new `nomad/structs/` package Request and Response structs
    29  
    30  ## Docs
    31  
    32  * [ ] Changelog
    33  * [ ] API docs https://www.nomadproject.io/api
    34  * [ ] CLI docs https://www.nomadproject.io/docs/commands
    35  * [ ] If adding new docs see [website README](../website/README.md#editing-navigation-sidebars)
    36  * [ ] Consider if it needs a guide https://www.nomadproject.io/guides/index.html