Skip to content

fix(cli): report a missing value before the next known flag - #297

Open
MMexicann wants to merge 1 commit into
storytold:mainfrom
MMexicann:patch-12
Open

MMexicann wants to merge 1 commit into
storytold:mainfrom
MMexicann:patch-12

Conversation

@MMexicann

@MMexicann MMexicann commented Nov 21, 2026 •

Copy link
Copy Markdown

Summary

Report a missing value when the next token is a flag recognized by the current MaterialCraft command. This covers both flags that take values and boolean flags. Signed values and unrelated dash-prefixed values remain valid.

Verification

Rustfmt passed. An isolated Rust check ran the exact production parser and its tests. main accepted a following flag as the option value. The patch passed all four checks, including negative pitch, literal names, and automation-root aliases. The full CLI suite was not run.

Summary by CodeRabbit

  • Bug Fixes
    • Improved command-line option parsing so flags missing a value are reported clearly when followed by another recognized flag. Negative numbers and unknown option-like values remain accepted as values.

Updated argument parsing to prevent consuming the next known flag when a value is expected. Added tests to ensure correct error messages and flag handling.
@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The CLI parser now reports a missing-value error when a value-taking option is followed by a recognized flag. Tests cover this behavior and verify that negative numbers and unknown option-like tokens remain valid values.

Changes: Option value parsing

Layer / File(s) Summary
Validate option values
apps/materialcraft-cli/src/main.rs
The parser rejects recognized flags as values for options that require a value. Tests cover recognized flags, negative numeric values, and unknown option-like tokens.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: bflatastic

Merge Risk: Minimal · up to 1be48

The CLI now reports a missing value when an option is followed by another recognized flag, instead of silently consuming the flag as the value. Signed numbers and unrelated dash-prefixed values still work. No actionable merge risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the change: a missing option value is now reported before the next known flag. It matches the raw summary, which says a value-taking flag is rejected when its next token is a recognize…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the change: a missing option value is now reported before the next known flag. It matches the raw summary, which says a value-taking flag is rejected when its next token is a recognized flag, and the PR objectives, which describe the same behavior. The title uses the conventional fix(cli) prefix and is specific enough for a teammate scanning history.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

Clippy (1.99.1)

Clippy execution timed out
Clippy (1.99.1) exceeded its 180-second time budget. Findings from completed work are retained; remaining checks are incomplete.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 4ff5af9 and 1be4811.

Files selected for processing: 1

  • apps/materialcraft-cli/src/main.rs

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

This branch has not been deployed

No deployments
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