cli
cli copied to clipboard
Categories with no visible flags are still visible
My urfave/cli version is
v2.27.1
Checklist
- [*] Are you running the latest v2 release? The list of releases is here.
- [*] Did you check the manual for your release? The v2 manual is here
- [*] Did you perform a search about this problem? Here's the GitHub guide about searching.
Dependency Management
- My project is using go modules.
Describe the bug
Categories with no visible flags are still visible in the --help text output.
To reproduce
- Create a hidden flag with a unique category name and add it to the cli.App.
- Build the app and run with the --help flag.
Observed behavior
- The unique category name is visible even though there are no flags presented in the category
Expected behavior
- The unique category name is not visible in the --help output
Additional context
Nothing special.
Want to fix this yourself?
I've worked around this problem in my own projects and I don't know enough about the codebase (v2 and v3) to know if this is an easy fix or not.
Run go version and paste its output here
go version go1.21.5 linux/arm64
Run go env and paste its output here
GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/pruned/golang/cache'
GOENV='/pruned/golang/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS='-modcacherw'
GOHOSTARCH='arm64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/pruned/golang/modcache'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/quo'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/pruned/golang/go'
GOSUMDB='sum.golang.org'
GOTMPDIR='/pruned/golang/tmp'
GOTOOLCHAIN='auto'
GOTOOLDIR='/pruned/golang/go/pkg/tool/linux_arm64'
GOVCS=''
GOVERSION='go1.21.5'
GCCGO='gccgo'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/pruned/project/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/pruned/golang/tmp/go-build2354014409=/tmp/go-build -gno-record-gcc-switches'