Skip to content

Commit

Permalink
chore: Add CLI commands documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
masiedu4 committed Jul 29, 2024
1 parent c1fa1d4 commit e114a17
Show file tree
Hide file tree
Showing 2 changed files with 161 additions and 1 deletion.
160 changes: 160 additions & 0 deletions cartesi-rollups/development/cli-commands.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
---
id: cli-commands
title: CLI commands
---


The Cartesi CLI provides essential tools for developing, deploying, and interacting with Cartesi applications. This page offers a quick reference to available commands and usage.

## Basic Usage
To use any command, run:

```bash
cartesi [COMMAND]
```

For detailed help on a specific command, use:

```bash
cartesi help [COMMAND]
```

## Core Commands

| Command | Description |
|---------|-------------|
| `create` | Create a new application |
| `build` | Build the application |
| `run` | Run the application node |
| `send` | Send input to the application |
| `deploy` | Deploy application to a live network |
| `address-book` | Prints addresses of deployed smart contracts |
| `clean` | Clean build artifacts of the application |
| `doctor` | Verify the minimal system requirements |
| `hash` | Print the image hash generated by the build command |
| `shell` | Start a shell in the Cartesi machine of the application |


---
### `create`

Create a new Cartesi application from a template.

#### Usage:
```bash
cartesi create NAME --template <template-name> [--branch <value>]
```

#### Flags:

- `--template=<option>`: (required) Template name to use (options: `cpp`, `cpp-low-level`, `go`, `javascript`, `lua`, `python`, `ruby`, `rust`, `typescript`).
- `--branch=<value>`: [cartesi/application-templates](https://github.com/cartesi/application-templates) repository branch name to use.

---


### `build`
Build the application, creating a Cartesi Machine snapshot.

#### Usage:
```bash
cartesi build [--from-image <value>] [--target <value>]
```

#### Flags:
- `--from-image=<value>`: Skip Docker build and start from this image.
- `--target=<value>`: Target of Docker multi-stage build.

---

### `run`
Run a local Cartesi node for the application.

#### Usage:
```bash
cartesi run [--block-time <value>] [--epoch-duration <value>] [--no-backend] [-v] [--listen-port <value>]
```

#### Flags:

- `--block-time=<value>`: Interval between blocks in seconds (default: 5).
- `--epoch-length=<value>`: length of an epoch in blocks (default: 7200).
- `--no-backend`: Run a node without the application code.
- `-v`, `--verbose`: Verbose output.
- `--listen-port=<value>`: Port to listen for incoming connections (default: 8080).

---

### `send`
Send input to the application in interactive mode.

#### Usage:
```bash
cartesi send
```

#### Sub-commands:

- `send dapp-address`: Send DApp address input.
- `send erc20`: Send ERC-20 deposit.
- `send erc721`: Send ERC-721 deposit.
- `send ether`: Send ether deposit.
- `send generic`: Send generic input.
---


### `deploy`
Deploy the application to a live network.

#### Usage:
```bash
cartesi deploy --webapp <value> [--hosting self-hosted|third-party]
```

#### Flags:
- `--webapp=<value>`: (required) Address of deploy webapp.
- `--hosting=<option>`: Hosting type (options: self-hosted, third-party).

---


### `address-book`
Prints addresses of deployed smart contracts.

#### Usage:
```bash
cartesi address-book [--json]
```

#### Flags:
- `--json`: Format output as JSON

---

### `shell`

Start a shell in the Cartesi machine of the application.

#### Usage:
```bash
cartesi shell [IMAGE] [--run-as-root]
```

#### Flags:

```bash
--run-as-root: Run as root user
```
---

### Additional Commands

- `clean`: Delete all cached build artifacts of the application.
- `doctor`: Verify the minimal system requirements.
- `hash`: Print the image hash generated by the build command.

For the most up-to-date and detailed information, always refer to the built-in help command:

```bash
cartesi help [COMMAND]
```
2 changes: 1 addition & 1 deletion sidebarsRollups.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ module.exports = {
"development/building-the-application",
"development/running-the-application",
"development/node-configuration",
"development/cli-commands",
"development/send-requests",
"development/retrieve-outputs",

"development/asset-handling",
"development/migration"
],
Expand Down

0 comments on commit e114a17

Please sign in to comment.