Skip to content

test: add shell-completion case for hidden BoolWithInverseFlag #2405

Closed

Description

@dearchap

Follow-up from review of #2388.

Summary

PR #2388 changed printFlagSuggestions in help.go to skip flags via the VisibleFlag/IsVisible() interface instead of the previous flag.(*BoolFlag) assertion. The previous check only skipped hidden bool flags, and because the *BoolFlag assertion does not match the *BoolWithInverseFlag concrete type, hidden BoolWithInverseFlags were also leaked into shell completion suggestions.

That leak is now fixed by the interface-based check, but the regression test table in TestDefaultCompleteWithFlags only covers the BoolFlag (hidden-bool) and StringFlag (new in #2388) cases.

Proposed change

Add a BoolWithInverseFlag case to the TestDefaultCompleteWithFlags table (e.g. a hidden --excellent BoolWithInverseFlag) to lock in the fix for this type too.

Impact

  • Low risk; test-only change.

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