# `WardrikDaemon.CLI`

The `wardrik` command, also installed as `rik`.

    wardrik agent ls
    wardrik ask triage "What's new?"
    wardrik approval approve triage CALL --json

Each command runs an operation on the daemon over its HTTP API. It acts with the token the daemon
writes to `cli_token` as it starts. `WARDRIK_URL` and `WARDRIK_TOKEN` point it at another daemon.

Commands are grouped in namespaces, as `agent ls` and `token create`. `ask`, `follow` and `ls`
are shortcuts. Each is a `WardrikDaemon.CLI.Command`, defined once for its help, its options and
running it.

Every command takes `--json`, and then prints the operation's JSON. An agent is named by its ID,
as `acme/triage`, or without the deployment's org, as `triage` or `@jon/notes`.

`serve`, `start`, `stop`, `pid`, `logs` and `service` run the daemon itself, so the `bin/wardrik`
script handles them.

# `commands`

```elixir
@spec commands() :: [WardrikDaemon.CLI.Command.t()]
```

Returns every command, in the order help lists them within each group.

# `halt`

```elixir
@spec halt([String.t()]) :: no_return()
```

Runs the command `argv` names, as `bin/wardrik` does, then halts the VM with its exit status.

# `main`

```elixir
@spec main([String.t()], keyword()) :: 0 | 1
```

Runs the command `argv` names. Returns the exit status.

## Options

  * `:env` - the environment. `System.get_env/0` unless set.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
