Skip to content

Consider adopting Cobra's flag-grouping validation helpers #5054

Description

@tripledoublev

Flyctl commands that need mutually-exclusive/required-together/one-of flag validation (e.g. mpg restore's --backup-id/--pitr-time) currently do this by hand in command logic. Cobra ships built-in helpers for this — MarkFlagsMutuallyExclusive, MarkFlagsOneRequired, MarkFlagsRequiredTogether — which validate at flag-parse time with consistent error messages, but they're currently unused anywhere in the codebase (only plain MarkFlagRequired is used, in certificates/root.go).

Worth evaluating whether migrating existing manual flag-combination checks to these helpers would reduce duplicated validation logic and give users more consistent error messages across commands.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions