Skip to content

chore: use cobra flag group for config flags#3477

Merged
Yuan325 merged 7 commits into
mainfrom
cobra-exclusive-flag
Jun 24, 2026
Merged

chore: use cobra flag group for config flags#3477
Yuan325 merged 7 commits into
mainfrom
cobra-exclusive-flag

Conversation

@Yuan325

@Yuan325 Yuan325 commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Description

Use cobra flag groups (MarkFlagsMutuallyExclusive) for the config flags.

The following error occurs during startup when both --config and --configs were set.

Error: if any flags in the group [config configs config-folder tools-file tools-files tools-folder] are set none of the others can be; [config configs] were all set

🛠️ Fixes #782

@Yuan325 Yuan325 requested a review from a team as a code owner June 18, 2026 16:55

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the ConfigFileFlags function to accept the parent Cobra command and enforces mutual exclusivity among the configuration flags (config, configs, and config-folder). The reviewer suggests extending this mutual exclusivity validation to also include the deprecated alias flags (tools-file, tools-files, and tools-folder) to prevent users from bypassing the validation when mixing deprecated and new flags.

Comment thread cmd/internal/flags.go Outdated
Yuan325 and others added 3 commits June 18, 2026 10:00
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@Yuan325 Yuan325 force-pushed the cobra-exclusive-flag branch from 8d30576 to 0b26200 Compare June 24, 2026 18:07
@Yuan325 Yuan325 enabled auto-merge (squash) June 24, 2026 21:44
@Yuan325 Yuan325 merged commit b2060b0 into main Jun 24, 2026
24 checks passed
@Yuan325 Yuan325 deleted the cobra-exclusive-flag branch June 24, 2026 22:12
@github-actions

Copy link
Copy Markdown
Contributor

🧨 Preview deployments removed.

Cloudflare Pages environments for pr-3477 have been deleted.

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.

Use cobra flag groups for tool file configuration flag

2 participants