Skip to content

feat: --help-json flag for structured CLI discovery#43

Merged
Andarius merged 4 commits intomasterfrom
feat/help-json
Mar 14, 2026
Merged

feat: --help-json flag for structured CLI discovery#43
Andarius merged 4 commits intomasterfrom
feat/help-json

Conversation

@Andarius
Copy link
Owner

@Andarius Andarius commented Mar 8, 2026

  • Add ShowHelpJsonError exception and detection in CommandGroup.run_with_args()
  • Add piou/help_json.py module with JSON serialization of the full command tree
  • --help-json outputs structured JSON with callable choices shown as "<dynamic>"
  • --help-json=full resolves callable choices (including async) via run_function()
  • Subcommand targeting: cli foo --help-json outputs just the foo command schema
  • __main__ commands are excluded from group output, secrets hide their defaults

- Add `ShowHelpJsonError` exception and detection in `CommandGroup.run_with_args()`
- Add `piou/help_json.py` module with JSON serialization of the full command tree
- `--help-json` outputs structured JSON with callable choices shown as `"<dynamic>"`
- `--help-json=full` resolves callable choices (including async) via `run_function()`
- Subcommand targeting: `cli foo --help-json` outputs just the `foo` command schema
- `__main__` commands are excluded from group output, secrets hide their defaults
@Andarius Andarius self-assigned this Mar 8, 2026
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import Performance

Details
Benchmark suite Current: dd2c13a Previous: 1b7d96c Ratio
piou (core) 88.17 ms (0.82) 80.23 ms (1.51) 1.10
piou (rich) 165.58 ms (2.03) 153.49 ms (10.53) 1.08
piou.tui 302.29 ms (1.91) 274.21 ms (1.99) 1.10

This comment was automatically generated by workflow using github-action-benchmark.

@Andarius Andarius marked this pull request as ready for review March 14, 2026 09:27
@Andarius Andarius merged commit 217a102 into master Mar 14, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant