# CLI

Learn about the Vale command-line interface.

The Vale CLI is a powerful tool for linting your content in a variety of formats. To get started, try running with no arguments:

![Vale's help text](/files/4c0784cec5d1349c5b5bbb37cc43c7b6d1489a31)

## [Environment variables](#environment-variables)

The following list of environment variables are supported by the `vale` command-line interface:

| Variable           | Description                                                         |
| ------------------ | ------------------------------------------------------------------- |
| `VALE_CONFIG_PATH` | Override the default search process by specifying a .vale.ini file. |
| `VALE_STYLES_PATH` | Specify the location of the default StylesPath.                     |

You can inspect the current environment variables by running:

```
$ vale ls-vars
```

The exact steps for setting environment variables depend on your operating system, but here are some useful links for [Windows](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/setx) and [macOS](https://support.apple.com/guide/terminal/use-environment-variables-apd382cc5fa-4f58-4449-b20a-41c53c006f8f/mac).

## [CLI options](#cli-options)

| Name              | Description                                                                                                                                                                                                      |
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `sync`            | <p>Download and install packages. See <a href="/pages/9c0d0f187b18e5c5f584dbcd08f05b78015cb529">Packages</a> for more information.<br><code>\<br>$ vale sync\<br></code></p>                                     |
| `ls-config`       | <p>Print the current configuration options as JSON.<br><code>\<br>$ vale ls-config\<br></code></p>                                                                                                               |
| `ls-metrics`      | <p>Print the computed metrics for the given file. See <a href="/pages/e4e23859394b0d893f81f7d87a16990cfd321a3b">metric</a> for more information.<br><code>\<br>$ vale ls-metrics path/to/file\<br></code></p>    |
| `ls-dirs`         | <p>Print the location of default configuration directories.<br><code>\<br>$ vale ls-dirs\<br></code></p>                                                                                                         |
| `ls-vars`         | <p>Print the supported environment variables.<br><code>\<br>$ vale ls-vars\<br></code></p>                                                                                                                       |
| `--config`        | <p>Override the default configuration search process.<br><code>\<br>$ vale --config='path/to/.vale.ini' README.md\<br></code></p>                                                                                |
| `--ext`           | <p>Assign a file extension to stdin.<br>\`\`\`<br>$ echo "<em>This</em> is Markdown"</p>                                                                                                                         |
| `--filter`        | <p>An expression to filter rules by. See <a href="/pages/1ca74c93553907de9f4ef834acdc197c797ea53b">Filters</a> for more information.<br><code>\<br>$ vale --filter='"heading" in .Scope' test.md\<br></code></p> |
| `--glob`          | <p>A glob pattern to match files against. See <a href="/pages/2e2d8e9760081b393c82b5b8f5b13152bec9a645">Globbing</a> for more information.<br><code>\<br>$ vale --glob='\*.md' some-dir\<br></code></p>          |
| `--ignore-syntax` | <p>Treat all input as plain text.<br><code>\<br>$ vale --ignore-syntax README.md\<br></code></p>                                                                                                                 |
| `--no-exit`       | <p>Do not return a non-zero exit code if there are errors.<br><code>\<br>$ vale --no-exit README.md\<br></code></p>                                                                                              |
| `--no-wrap`       | <p>Do not wrap output.<br><code>\<br>$ vale --no-wrap README.md\<br></code></p>                                                                                                                                  |
| `--no-global`     | <p>Do not load the global configuration.<br><code>\<br>$ vale --no-global README.md\<br></code></p>                                                                                                              |
| `--output`        | <p>Change the output format. See <a href="/pages/2d1654ae6eb5e995f8144efc4d126122a2157019">Templates</a> for more information.<br><code>\<br>$ vale --output=JSON README.md\<br></code></p>                      |
| `--version`       | <p>Print the version of Vale.<br><code>\<br>$ vale --version\<br></code></p>                                                                                                                                     |

## [Return codes](#return-codes)

The `vale` CLI returns the following exit codes:

| Code | Description                                                                                  |
| ---- | -------------------------------------------------------------------------------------------- |
| `0`  | No error(s) were found.                                                                      |
| `1`  | Linting error(s) were found. Useful for failing CI builds; can be disabled with `--no-exit`. |
| `2`  | Runtime error(s) occurred.                                                                   |

It will try to respect the value of `--output` when printing to `stderr`. For example:

![Vale's exit codes](/files/8dd5a5f9ab4a8b14a83a7076d7c9e276a911c808)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.vale.sh/topics/cli.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
