Skip to content

BoolWithInverseFlag alias not shown in help #2216

@staranto

Description

@staranto

My urfave/cli version is

3.5.0

Dependency Management

  • My project is using go modules.

Describe the bug

Aliases defined for BoolWithInverseFlag are processed, but not shown in usage text.

To reproduce

&cli.BoolWithInverseFlag{
	Name:    "color",
	Aliases: []string{"c"},
	Usage:   "enable colored text output",
	Value: false,
},

Observed behavior

Usage text shown is --

--[no-]color     enable colored text output (default: false)

Expected behavior

I expected to see something like this which would be in line with BoolFlag.

--[no-]color, -c=true     enable colored text output (default: false)

Additional context

The short alias is functional. All of these work exactly like you would expect.

--color
--no-color
--color=true
--color=false
-c
-c=true
-c=false

Possibly related to #2131

Run go version and paste its output here

go version go1.24.0 linux/amd64

Run go env and paste its output here

AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE=''
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/home/xxx/.cache/go-build'
GOCACHEPROG=''
GODEBUG='http2client=0'
GOENV='/home/xxx/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build20609935=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/home/xxx/yyy/go.mod'
GOMODCACHE='/home/xxx/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/xxx/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/xxx/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.24.0'
GOWORK=''
PKG_CONFIG='pkg-config'

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/v3relates to / is being considered for v3kind/bugdescribes or fixes a bugstatus/triagemaintainers still need to look into this

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions