# validate

Source: https://libtmux.org/en/ruby/latest/workspace/cli/validate/

> Check a Ruby workspace configuration without contacting tmux.

`validate` reads and checks a YAML or JSON workspace without starting tmux,
opening a socket, creating a session, or running configured shell commands.
Use it before inspecting or applying a plan.

## Check a workspace

Save the [complete example configuration](https://libtmux.org/en/ruby/latest/workspace/examples/) as [`workspace.yaml`](<https://github.com/libtmux/libtmux-ruby/blob/30ae39fe3b58a3a964e0d1d8ba601d8a4523012c/examples/workspace.yaml>),
then validate it:

```console
$ libtmux-workspace validate workspace.yaml
```

Success prints `Workspace configuration is valid.` and exits with status `0`.
To request a JSON result:

```console
$ libtmux-workspace validate \
    --json \
    workspace.yaml
```

The result contains `valid`, `profile`, and `version`. Invalid configuration
exits with status `2`. In JSON mode, the error object is written to stdout;
otherwise diagnostics go to stderr.

## Options and limits

The [common options](https://libtmux.org/en/ruby/latest/workspace/cli/#input-and-common-options) control output and explicit
environment expansion. Omit the filename only when the current directory
contains exactly one discoverable configuration. `--socket`, `--live`,
`--attach`, `--switch`, and `--compensate` are invalid for validation.

Validation checks the [supported configuration format](https://libtmux.org/en/ruby/latest/workspace/topics/). It does
not prove that a session name is free on a server, a shell command will
succeed, or a program is installed. Use [live planning](https://libtmux.org/en/ruby/latest/workspace/cli/plan/#inspect-a-live-server)
to inspect the chosen server, and check [load results](https://libtmux.org/en/ruby/latest/workspace/cli/load/#results-and-failures)
when applying the workspace.

[CLI parser and implementation](https://github.com/libtmux/libtmux-ruby/blob/9b1545562a112353c2c893a1d3e8c0d9b4b51f8d/gems/libtmux-workspace/lib/libtmux/workspace/cli.rb).
