Skip to content

Support xor groups with positional arguments - #647

Open
ColumbusLabs wants to merge 3 commits into
alecthomas:masterfrom
ColumbusLabs:fix/positional-xor
Open

ColumbusLabs wants to merge 3 commits into
alecthomas:masterfrom
ColumbusLabs:fix/positional-xor

Conversation

@ColumbusLabs

Copy link
Copy Markdown

Fixes #255.

This validates xor groups against both flags and positional arguments owned by the same application or command node. A set positional can also satisfy required flags in its XOR group.

Grouping directly from each node keeps command scopes independent: command-local conflicts are rejected, while a root flag and child positional may reuse the same group name without conflicting.

Tests cover root and command positionals, single-side success, cross-scope isolation, and required-XOR satisfaction.

Verification:

  • go test ./...
  • go test -race ./...
  • ./bin/golangci-lint run
  • gofmt / git diff --check

@alecthomas

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 72fd6a4957

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread context.go Outdated
Comment thread kong.go Outdated
@ColumbusLabs

Copy link
Copy Markdown
Author

Addressed in 49c114d after rebasing onto current master. Required positional XOR alternatives now satisfy both missing-positional validation paths when a peer flag is set, and XOR/AND overlap validation compares value identity rather than display names. Added regressions for both cases. Verified with go test ./..., go test -race ./..., and ./bin/golangci-lint run.

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.

Xor is ignored with positional arguments

2 participants