My urfave/cli version is
v3.9.0
Checklist
Dependency Management
- My project is using go modules.
Describe the bug
I have added a custom completion to a subcommand but when I reach this point in a completion sequence only files are being completed, the custom completion is not even being called.
To reproduce
This is the subcommand:
func IndexShow(conf *cfg.Config) *cli.Command {
return &cli.Command{
Name: "show",
Aliases: []string{"sh"},
Usage: "show details about an index",
Action: func(ctx context.Context, cmd *cli.Command) error {
return es.IndexShow(conf, cmd.Args().Get(0))
},
ShellComplete: func(ctx context.Context, cmd *cli.Command) {
if cmd.NArg() > 0 {
return
}
indices, err := es.IndexNames(conf)
if err != nil {
return
}
for _, index := range indices {
fmt.Println(index)
}
},
}
}
Observed behavior
Nothing happens. Even if I add a panic(0) at the start of the custom completion func, it doesn't panic, so it's not being called.
Expected behavior
I'd expect to get a completion of the custom list printed, see above.
Additional context
Source: https://codeberg.org/scip/esctl/src/branch/main/cmd/index.go#L78
Run go version and paste its output here
Run go env and paste its output here
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/scip/.cache/go-build'
GOENV='/home/scip/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/scip/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/scip/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.23.5'
GODEBUG=''
GOTELEMETRY='off'
GOTELEMETRYDIR='/home/scip/.config/go/telemetry'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/dev/null'
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 -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build3675849324=/tmp/go-build -gno-record-gcc-switches'
My urfave/cli version is
v3.9.0Checklist
Dependency Management
Describe the bug
I have added a custom completion to a subcommand but when I reach this point in a completion sequence only files are being completed, the custom completion is not even being called.
To reproduce
This is the subcommand:
Observed behavior
Nothing happens. Even if I add a
panic(0)at the start of the custom completion func, it doesn't panic, so it's not being called.Expected behavior
I'd expect to get a completion of the custom list printed, see above.
Additional context
Source: https://codeberg.org/scip/esctl/src/branch/main/cmd/index.go#L78
Run
go versionand paste its output hereRun
go envand paste its output here