> ## Documentation Index
> Fetch the complete documentation index at: https://docs.codecrafters.io/llms.txt
> Use this file to discover all available pages before exploring further.

# How do I use the CLI?

The CodeCrafters CLI is a command-line tool that allows you to run tests & view test results
from your local machine. Using the CLI is faster than using Git since you don't need to
commit your changes to run tests.

If you haven't installed the CLI yet, [read this](/cli/installation).

To use the CLI, navigate to a CodeCrafters repository on your local machine and run the `codecrafters test` command:

```bash theme={null}
codecrafters test
```

To run tests against all previous stages first, add the `--previous` flag:

```bash theme={null}
codecrafters test --previous
```

You should see logs like this:

```bash theme={null}
Running tests on your codebase. Streaming logs...

[compile]    Compiling redis-starter-rust v0.1.0 (/app)
[compile]     Finished release [optimized] target(s) in 1.20s
[compile] Compilation successful.

[stage-1] Running tests for Stage #1: Bind to a port
[stage-1] $ ./spawn_redis_server.sh
[stage-1] Connecting to port 6379...
[your_program] Logs from your program will appear here!
[stage-1] Looks like your program has terminated. A redis server is expected to be a long-running process.
[stage-1] Test failed (try setting 'debug: true' in your codecrafters.yml to see more details)

View stage instructions: https://app.codecrafters.io/courses/redis.
```

You can then make changes to your codebase and re-run the tests by running `codecrafters test` again. You don't
need to commit your changes using Git to run tests using the CLI.
