Skip to content

Reject unused CLI arguments - #62

Merged
omlahore merged 1 commit into
omlahore:mainfrom
sean0407:codex/cli-argument-validation
Oct 18, 2026
Merged

omlahore merged 1 commit into
omlahore:mainfrom
sean0407:codex/cli-argument-validation

Conversation

@sean0407

@sean0407 sean0407 commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

+ Reject unused arguments for `features` and `tweaks`
+ Reject unknown option flags for `clean`
+ Explain when `--keep` is missing its feature names

These changes address the ignored-argument cases in #58.

Evidence

  • Before: On macOS 26.6.2 (25G83), features extra and tweaks bogus exited 0. clean --bogus --dry-run reported that --bogus was not in the cleanable list, and off --keep reported unknown option --keep.
  • After: All four commands exit non-zero with the relevant argument or option error.
  • Build: Debug and release builds passed with Swift 6.3.3; the release removemacai selftest passed all 85 checks. The CLI cases were run in an isolated macOS sandbox with networking disabled.

Merge Danger

Door: Two-way

Blast Radius: CLI argument validation. Extra arguments and unknown option flags now fail explicitly instead of being ignored or treated as names.

Summary by CodeRabbit

  • Bug Fixes
    • Improved command-line validation: commands now reject unexpected arguments, and options report an error when their value is missing or looks like another option.

@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8f12f381-e255-4ff7-ad25-9009cc2f7e72
📥 Commits

Reviewing files that changed from the base of the PR and between 4af72aa and 5d2479d.

📒 Files selected for processing: 1
  • Sources/removemacai/main.swift

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

📝 Walkthrough

The CLI now reports missing option values and rejects unexpected arguments in the features, tweaks, and clean commands.

Changes: CLI argument validation

Layer / File(s) Summary
Validate CLI arguments
Sources/removemacai/main.swift
option(_:) reports an error when an option has no value or its next argument begins with -. The features and tweaks commands reject remaining arguments. The clean command rejects remaining arguments that begin with -.

Priority: ⬇️ Low

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

Change: Bug fix

Suggested reviewers: omlahore

Merge Risk: ⚪ Minimal · up to 5d247

The empty --keep case remains a follow-up, not a regression from this PR. No actionable merge risk was identified in the reviewed changes.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title, "Reject unused CLI arguments," clearly and concisely describes the pull request's primary change: rejecting unused and invalid command-line arguments.
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Comment @coderabbitai help to get the list of available commands.

@omlahore

Copy link
Copy Markdown
Owner

i went through all four cases from #58 and each one exits with an error now 🙌
the --keep message is nicer than what i had in mind too
i'm merging it for 1.1.4

@omlahore
omlahore merged commit d5fe873 into omlahore:main Oct 18, 2026
1 check 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.

2 participants