# `WardrikDaemon.CLI.Command`

One command `wardrik` takes, defined once for its help, its options and running it.

    %WardrikDaemon.CLI.Command{
      name: "agent ls",
      shortcut: "ls",
      group: "Agents",
      arguments: "[QUERY]",
      switches: [all: :boolean],
      count: {0, :any},
      summary: "list the agents, and what each is doing",
      run: &ls/3
    }

## Fields

  * `:name` - required. The words that name it, as `agent ls`.
  * `:group` - required. The group help lists it under.
  * `:summary` - required. One line on what it does.
  * `:arguments` - how its arguments are typed in help, as `AGENT MESSAGE`.
  * `:details` - more lines for its own help.
  * `:switches` - the options it takes, as `OptionParser` takes them.
  * `:count` - how many arguments it takes: a number, or `{least, :any}`. `0` unless set.
  * `:shortcut` - a shorter name it also takes, as `ls`.
  * `:run` - takes the arguments, the switches and the `WardrikDaemon.CLI.Context`. `nil` for a
    command `bin/wardrik` runs itself.

# `run`

```elixir
@type run() :: ([String.t()], map(), WardrikDaemon.CLI.Context.t() -&gt;
            :ok | {:error, String.t()})
```

# `t`

```elixir
@type t() :: %WardrikDaemon.CLI.Command{
  arguments: String.t(),
  count: non_neg_integer() | {non_neg_integer(), :any},
  details: [String.t()],
  group: String.t(),
  name: String.t(),
  run: run() | nil,
  shortcut: String.t() | nil,
  summary: String.t(),
  switches: keyword()
}
```

# `takes?`

```elixir
@spec takes?(t(), non_neg_integer()) :: boolean()
```

Returns whether `command` takes `count` arguments.

# `usage`

```elixir
@spec usage(t()) :: String.t()
```

Returns how `command` is typed, as `agent show AGENT [--json]`.

# `words`

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

Returns the words that name `command`.

---

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