Skip to content

Validate mutually exclusive CLI flags #1392

Description

@Rupam0710

Search before asking

  • I searched in the issues and found nothing similar.

Motivation

Users can currently combine incompatible CLI flags without receiving feedback, leading to confusion:

  • --fullscreen with window sizing options (--width, --height, --min-width, --min-height) - conflicting approaches to fill the window
  • --fullscreen with --maximize - two different window fill modes
  • --start-to-tray with --maximize - can't maximize a window that starts hidden

These combinations are silently ignored or produce unexpected behavior. Early validation with clear error messages would improve user experience.

Solution

Implement validateMutuallyExclusiveFlags() validation function that:

Implementation includes:

  • New validation function in bin/utils/validate.ts
  • Integration in bin/cli.ts after config merge
  • 23 comprehensive test cases covering all scenarios

Alternatives

  1. Silent ignore with warning - Considered warning users but still ignoring the conflicting flag. Rejected because it's less clear than hard validation.

  2. Config-file only validation - Could validate only in config files, not CLI. Rejected because CLI users deserve the same protection.

  3. Runtime error - Could let the app start and error at runtime. Rejected because early validation in input phase is clearer and prevents wasted build time.

Anything else?

This follows the established pattern from recent merged PRs:

Test coverage: 23 new tests + 516 existing tests all passing (519 total, 0 regressions)
Exit codes and error format are compatible with --json machine mode.

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions