Skip to content

refactor: use Commander.js .conflicts() for mutually exclusive options#446

Merged
henrikje merged 1 commit intomainfrom
mutually-exclusive-options
Mar 27, 2026
Merged

refactor: use Commander.js .conflicts() for mutually exclusive options#446
henrikje merged 1 commit intomainfrom
mutually-exclusive-options

Conversation

@henrikje
Copy link
Copy Markdown
Owner

Replace manual if/error/throw validation blocks with declarative
.conflicts() declarations on Option objects. This catches conflicts at
parse time (before action handlers run) and removes 11 manual checks
across 8 command files.

Migrated conflicts:

  • --quiet/--json/--verbose/--schema (status, list, branch show, repo list, log)
  • --rebase/--merge (pull)
  • --soft/--mixed/--hard (reset)
  • --repo/--workspace (template add)

Kept as manual checks (custom error messages with actionable hints):

  • --dirty/--where ("Use --where dirty,... instead")
  • --no-status/filters ("Status gathering is required")
  • Option-vs-argument conflicts (Commander can't express these)

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

Replace manual if/error/throw validation blocks with declarative
.conflicts() declarations on Option objects. This catches conflicts at
parse time (before action handlers run) and removes 11 manual checks
across 8 command files.

Migrated conflicts:
- --quiet/--json/--verbose/--schema (status, list, branch show, repo list, log)
- --rebase/--merge (pull)
- --soft/--mixed/--hard (reset)
- --repo/--workspace (template add)

Kept as manual checks (custom error messages with actionable hints):
- --dirty/--where ("Use --where dirty,... instead")
- --no-status/filters ("Status gathering is required")
- Option-vs-argument conflicts (Commander can't express these)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@henrikje henrikje enabled auto-merge (rebase) March 27, 2026 05:27
@henrikje henrikje merged commit d82cf45 into main Mar 27, 2026
10 checks passed
@henrikje henrikje deleted the mutually-exclusive-options branch March 27, 2026 05: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

Development

Successfully merging this pull request may close these issues.

1 participant