# `CliMate.CLI.ProcessShell`
[🔗](https://github.com/lud/cli_mate/blob/v0.10.2/lib/cli_mate/cli/process_shell.ex#L1)

An output shell implementation allowing your CLI commands to send their output
as messages to themselves. This is most useful for tests.

The process that will receive the messages is found by looking up the first
pid in the `:"$callers"` key of the process dictionary, or `self()` if there
is no caller.

Use `CliMate.CLI.put_shell(CliMate.CLI.ProcessShell)` to enable this shell.

This shell is called when calling one of:

* `CliMate.CLI.error/1
* `CliMate.CLI.warn/1
* `CliMate.CLI.debug/1
* `CliMate.CLI.success/1
* `CliMate.CLI.writeln/1
* `CliMate.CLI.halt_success/1
* `CliMate.CLI.halt_error/1
* `CliMate.CLI.halt_error/2

A message of type `t:shell_message/0` will be sent to `self()`, or the caller
process for `Task.async/1` and similar task functions.

# `kind`

```elixir
@type kind() :: :error | :warn | :debug | :info
```

# `shell_message`

```elixir
@type shell_message() :: {:cli_mate_shell, kind(), iodata()}
```

# `build_message`

```elixir
@spec build_message(kind(), iodata()) :: {:cli_mate_shell, kind(), iodata()}
```

# `message_target`

Returns the pid of the process that will receive output messages.

---

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