Commit 1816278
committed
feat(cli): add --output json/yaml to sandbox get, status, and sandbox create
Add structured output support to three commands that previously only
supported human-readable table output:
- `sandbox get --output json/yaml`: emits sandbox detail including
policy source, revision, and active policy content via a new
`sandbox_detail_to_json` converter.
- `status --output json/yaml`: emits gateway connection state via a new
`status_to_json` converter with conditional fields (auth, version,
error, http_status) matching the human output.
- `sandbox create --output json/yaml`: emits sandbox metadata after the
sandbox reaches Ready phase, suppressing spinners and ANSI chrome
from stdout. Uploads and port forwarding still execute before output.
Clap rejects `--output` combined with `--editor` or trailing commands.
All three commands reuse the existing `OutputFormat` enum and
`print_output_single` helper. Default output (no --output flag) is
byte-identical to current behavior. Unit tests cover both converters.
Closes #1964
Assisted-By: 🤖 Claude Code
Signed-off-by: Roland Huß <rhuss@redhat.com>1 parent 2c54589 commit 1816278
6 files changed
Lines changed: 380 additions & 69 deletions
File tree
- crates/openshell-cli
- src
- tests
- docs/sandboxes
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
533 | 533 | | |
534 | 534 | | |
535 | 535 | | |
536 | | - | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
537 | 541 | | |
538 | 542 | | |
539 | 543 | | |
| |||
1336 | 1340 | | |
1337 | 1341 | | |
1338 | 1342 | | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
1339 | 1347 | | |
1340 | 1348 | | |
1341 | 1349 | | |
| |||
1349 | 1357 | | |
1350 | 1358 | | |
1351 | 1359 | | |
1352 | | - | |
| 1360 | + | |
1353 | 1361 | | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
1354 | 1366 | | |
1355 | 1367 | | |
1356 | 1368 | | |
| |||
2079 | 2091 | | |
2080 | 2092 | | |
2081 | 2093 | | |
2082 | | - | |
| 2094 | + | |
2083 | 2095 | | |
2084 | 2096 | | |
2085 | 2097 | | |
2086 | | - | |
| 2098 | + | |
| 2099 | + | |
| 2100 | + | |
| 2101 | + | |
| 2102 | + | |
| 2103 | + | |
| 2104 | + | |
2087 | 2105 | | |
2088 | 2106 | | |
2089 | 2107 | | |
| |||
2612 | 2630 | | |
2613 | 2631 | | |
2614 | 2632 | | |
| 2633 | + | |
2615 | 2634 | | |
2616 | 2635 | | |
2617 | 2636 | | |
| |||
2697 | 2716 | | |
2698 | 2717 | | |
2699 | 2718 | | |
| 2719 | + | |
2700 | 2720 | | |
2701 | 2721 | | |
2702 | 2722 | | |
| |||
2769 | 2789 | | |
2770 | 2790 | | |
2771 | 2791 | | |
2772 | | - | |
| 2792 | + | |
| 2793 | + | |
| 2794 | + | |
| 2795 | + | |
| 2796 | + | |
2773 | 2797 | | |
2774 | | - | |
| 2798 | + | |
| 2799 | + | |
2775 | 2800 | | |
2776 | 2801 | | |
2777 | 2802 | | |
| |||
3455 | 3480 | | |
3456 | 3481 | | |
3457 | 3482 | | |
3458 | | - | |
| 3483 | + | |
3459 | 3484 | | |
3460 | 3485 | | |
3461 | 3486 | | |
| |||
0 commit comments