Commands - pRustIO Guide

# Commands

Here is a complete list of commands and their options that you can use to manage your embedded projects.

## Project Management

### Creating a Project

Creates all the necessary setup files and a basic starting code file.

    prustio project init [PROJECT_NAME] [OPTIONS]

- `[PROJECT_NAME]`: (Optional) The name of your new project.
- `-b, --board <BOARD>`: Specify the target board (e.g., `uno`, `nano`).
- `--hybrid`: Create a hybrid project that uses Arduino C++ functions.
- `--json-output`: Print the output in JSON format (useful for scripts).

### Cleaning a Project

Deletes the created build files to save disk space or start a fresh build.

    prustio clean [OPTIONS]

- `--json-output`: Print the output in JSON format.

## Building and Uploading

The `run` command checks your setup, compiles the code, and uploads it to the board.

    prustio run [OPTIONS]

- `-t, --target <TARGET>`: Choose what to do. Use `build` to only compile the code, or `upload` to compile and send it to the board (default).
- `-e, --environment <ENVIRONMENT>`: Build for a specific environment if you have more than one.
- `--json-output`: Print the output in JSON format.

## Device & Serial Monitor

### Finding Connected Devices

Check which microcontrollers and serial devices are connected to your computer:

    prustio device list [OPTIONS]

- `--json-output`: Print the device list in JSON format.

### Interactive Serial Monitor

Open the built-in serial monitor to communicate with your device.

    prustio device monitor [OPTIONS]

- `-p, --port <PORT>`: The specific serial port to connect to (e.g., `/dev/ttyACM0`).
- `-b, --baud <BAUD>`: The communication speed (e.g., `115200`).
- `--parity <PARITY>`: Parity check mode (Accepts: `N`, `E`, `O`, `S`, `M`. Default is `N`).
- `--rtscts`: Enable hardware flow control.
- `--xonxoff`: Enable software flow control.
- `--rts <RTS>`: Set the RTS pin state (0 or 1).
- `--dtr <DTR>`: Set the DTR pin state (0 or 1).
- `--echo`: Show what you type in the terminal.
- `--encoding <ENCODING>`: The text encoding to use (Default is `UTF-8`).
- `-f, --filter <FILTER>`: Apply a text filter to the output.
- `--eol <EOL>`: End of line characters (Accepts: `CR`, `LF`, `CRLF`. Default is `CRLF`).
- `--raw`: Do not format the output.
- `--exit-char <EXIT_CHAR>`: ASCII code for the exit shortcut (Default is `3`, which is Ctrl+C).
- `--menu-char <MENU_CHAR>`: ASCII code for the menu shortcut (Default is `20`).
- `--quiet`: Do not show extra connection messages.
- `--no-reconnect`: Do not automatically try to reconnect if the device disconnects.

## Environment Management

### Activating an Environment

Change the active board. This updates the settings for the new hardware.

    prustio activate <ENVIRONMENT_NAME> [OPTIONS]

- `<ENVIRONMENT_NAME>`: (Required) The name of the environment to activate.
- `--json-output`: Print the output in JSON format.

### Updating Settings

If you change your `Prustio.toml` file manually, force pRustIO to update the project settings to match:

    prustio refresh [OPTIONS]

- `--json-output`: Print the output in JSON format.

## Other Commands

### List Supported Boards

See all the microcontrollers that pRustIO supports.

    prustio boards [FILTER] [OPTIONS]

- `[FILTER]`: (Optional) Search for a specific board name (e.g., `nano`).
- `--json-output`: Print the output in JSON format.