Skip to content

How to ignore unrecognized flags? #2027

Closed Answered by rsteube
BatmanAoD asked this question in Q&A
Discussion options

You must be logged in to vote

Setting the environment variable CARAPACE_LENIENT=1 allows unknown flags globally to circumvent such issues.
There are some disadvantages to this however. Like how these are generally handled as bool flags.
So flag arguments like go test -tags unit might be better passed as go test -tags=unit if the command accepts it.

Overlays are intended as a (temporary) workaround for this and also provide a way to complete the unknown flag.

name: go
commands:
  - name: test
    description: test packages
    flags:
      -tags=: a comma-separated list of build tags
    completion:
      flag:
        tags: ["$_tools.golang.BuildTags ||| $uniquelist(,)"]

The reason why unknown flags break completion i…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@BatmanAoD
Comment options

@rsteube
Comment options

Answer selected by BatmanAoD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants