Skip to content

Comments

fix(repl): add --json flag, error on unknown flags, route imports/importers through parse_flags#153

Closed
rocketman-code wants to merge 1 commit intomainfrom
fix/repl-flag-enhancements
Closed

fix(repl): add --json flag, error on unknown flags, route imports/importers through parse_flags#153
rocketman-code wants to merge 1 commit intomainfrom
fix/repl-flag-enhancements

Conversation

@rocketman-code
Copy link
Owner

Summary

Closes #143, closes #144, closes #147, closes #152

  • Add --json inline flag to all REPL commands that produce output (trace, chain, cut, packages, imports, importers), enabling structured JSON output for scripting and piping
  • Change parse_flags to return Result, rejecting unknown -- flags with a helpful error listing valid options instead of silently ignoring them
  • Route imports and importers commands through parse_flags instead of require_arg, giving them access to all inline flag overrides (previously they only accepted a bare file argument)
  • Update help text to document --json as an available inline flag

Test plan

  • All 77 REPL unit tests pass (cargo test --lib repl)
  • New tests cover --json flag parsing and unknown flag error handling
  • Full workspace tests pass (301 passed, 10 ignored)
  • cargo clippy --workspace --all-targets -- -D warnings clean
  • cargo fmt --check clean

…orters through parse_flags

- Add `json: bool` field to `CommandOptions` struct
- Change `parse_flags` to return `Result`, rejecting unknown `--` flags
  with a helpful error message listing valid flags
- Route `imports` and `importers` commands through `parse_flags` instead
  of `require_arg`, giving them access to inline flag overrides
- Add `--json` output support to trace, chain, cut, packages, imports,
  and importers dispatch functions
- Update help text to document `--json` as an inline flag
- Add tests for `--json` parsing and unknown flag error handling
@rocketman-code
Copy link
Owner Author

Closing: patch contents already on main. Branch has zero diff after rebase.

@rocketman-code rocketman-code deleted the fix/repl-flag-enhancements branch February 22, 2026 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant