My urfave/cli version is
c6c5804
Checklist
Describe the bug
L1 commands get a condition saying there should not be any commands present. L2 commands only say that their parent should be present and so will suggest the same subcommand again.
To reproduce
app := &cli.Command{
Name: "mycli",
Version: "1.0.0",
Usage: "Pure awesomeness.",
EnableShellCompletion: true,
Suggest: true,
Commands: []*cli.Command{
{
Name: "more-awesome",
Usage: "Become awesomer!",
Action: func(ctx context.Context, cmd *cli.Command) error {
return nil
},
Commands: []*cli.Command{
{
Name: "set",
Usage: "Set new awesomeness.",
},
},
},
},
}
Observed behavior
Set is suggested even though we are already "at" set.
[13:44] mycli more-awesome set <tab>
h (Shows a list of commands or help for one command) set (Set new awesomeness.)
help (Shows a list of commands or help for one command)
Expected behavior
Want only relevant subcommands.
Want to fix this yourself?
In order to address this, completions that are siblings should have a negative condition on the list of siblings, sort of like saying "only one of these commands should be completed". PR pending.
Run go version and paste its output here
go version go1.23.8 linux/amd64
Run go env and paste its output here
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/andqvi/.cache/go-build'
GOENV='/home/andqvi/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/andqvi/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/andqvi/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/andqvi/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.23.8.linux-amd64'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/andqvi/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.23.8.linux-amd64/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.23.8'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/andqvi/.config/go/telemetry'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/andqvi/projects/external/harness-cli/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 -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build320049062=/tmp/go-build -gno-record-gcc-switches'
My urfave/cli version is
c6c5804
Checklist
Describe the bug
L1 commands get a condition saying there should not be any commands present. L2 commands only say that their parent should be present and so will suggest the same subcommand again.
To reproduce
Observed behavior
Set is suggested even though we are already "at" set.
Expected behavior
Want only relevant subcommands.
Want to fix this yourself?
In order to address this, completions that are siblings should have a negative condition on the list of siblings, sort of like saying "only one of these commands should be completed". PR pending.
Run
go versionand paste its output hereRun
go envand paste its output here