Skip to content

Fix required Bash flag completion - #2466

Open
giri256 wants to merge 1 commit into
spf13:mainfrom
giri256:fix/bash-required-two-word-flag
Open

Fix required Bash flag completion#2466
giri256 wants to merge 1 commit into
spf13:mainfrom
giri256:fix/bash-required-two-word-flag

Conversation

@giri256

@giri256 giri256 commented Jul 27, 2026

Copy link
Copy Markdown

Fixes #2465.

Required value flags are emitted into the Bash completion state with an equals
suffix, such as --config=. The existing handler canonicalized
--config=value to that spelling, but compared two-word input as --config,
so the required set remained active.

This derives a separate name only for the required-set comparison when the
flag is a known two-word flag. The original flag name remains unchanged for
flag values, local flags, and argument skipping.

The regression executes the generated Bash script and covers:

  • --required=value;
  • --required value;
  • an unrelated optional value flag;
  • a required boolean flag;
  • a required shorthand value flag.

Validation:

  • go test ./...
  • go vet ./...
  • gofmt
  • git diff --check

Signed-off-by: Giridhar <80974392+giri256@users.noreply.github.com>
@CLAassistant

CLAassistant commented Jul 27, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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.

Bash completion does not clear required flags when supplied as --flag value

2 participants