Skip to content
This repository was archived by the owner on May 4, 2026. It is now read-only.

Commit ab6e69b

Browse files
authored
Merge pull request #558 from ProvableHQ/josh/json_cli
Add `--json-output` flag documentation for CLI commands
2 parents c9f3e9b + d9a5cba commit ab6e69b

2 files changed

Lines changed: 45 additions & 0 deletions

File tree

documentation/cli/00_overview.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,19 @@ Specifies the path to Leo program root folder. Defaults to `./`.
6464

6565
#### `--home <HOME>`
6666
Specifies the path to the `.aleo` program registry. This is where programs downloaded from the network will be cached. Defaults to `~/.aleo/registry`.
67+
68+
#### `--json-output[=<PATH>]`
69+
Saves structured JSON output to disk.
70+
71+
- **Default location**: `build/json-outputs/<command>.json`
72+
- **Custom path**: `--json-output=my-results.json`
73+
74+
Supported commands: `deploy`, `upgrade`, `run`, `execute`, `test`, `query`, `synthesize`.
75+
76+
```bash title="Examples"
77+
# Save to default location (build/json-outputs/run.json)
78+
leo run --json-output main 1u32 2u32
79+
80+
# Save to custom path
81+
leo execute main --json-output=my-results.json
82+
```

documentation/cli/06_deploy.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,35 @@ Once it is deployed, it CANNOT be changed.
7777

7878
See the **[Deploying](./../guides/03_deploying.md)** guide for more details.
7979

80+
### JSON Output
81+
82+
Use `--json-output` to save structured JSON results to disk for programmatic use:
83+
84+
```bash
85+
# Save to default location (build/json-outputs/deploy.json)
86+
leo deploy --json-output -y
87+
88+
# Save to custom path
89+
leo deploy --json-output=deployment_result.json -y
90+
```
91+
92+
Example output (`build/json-outputs/deploy.json`):
93+
```json
94+
{
95+
"deployments": [
96+
{
97+
"program_id": "my_program.aleo",
98+
"transaction_id": "at1..."
99+
}
100+
]
101+
}
102+
```
103+
104+
This is useful for scripting and CI/CD pipelines:
105+
```bash
106+
# Deploy and extract the transaction ID
107+
jq '.deployments[0].transaction_id' build/json-outputs/deploy.json
108+
```
80109

81110
### Flags:
82111

0 commit comments

Comments
 (0)