Comments (5)
@bobheadxi Can you provide an example of what you are doing in the completion func ?
from cli.
Can you provide an example of what you are doing in the completion func ?
The bug occurs even if you don't do anything in the completion func directly (see description - it seems to happen in urfave/cli before the handler actually executes), but sourcegraph/sourcegraph#58569 has a concrete example
from cli.
The reason I ask is that I dont see the issue when the completion func is not set. Let me investigate further. I have specified an invalid flag on the command line and then tried completion of a valid flag and it works just fine
$ issue_1822 command subcommand --stss --
--help --stringflag
$ issue_1822 command subcommand --stss --stringflag
from cli.
Hm, now that I'm taking a closer look it seems I can't reproduce it either:
if err := (&cli.App{
Name: "sg",
EnableBashCompletion: true,
Commands: []*cli.Command{{
Name: "bar",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "stringflag",
Value: "vcs",
},
},
// internal helper used in my panic scenario
BashComplete: completions.CompletePositionalArgs(func(args cli.Args) (options []string) {
return []string{args.First()}
}),
Action: func(ctx *cli.Context) error {
println("action!")
return nil
},
}},
}).RunContext(context.Background(), os.Args); err != nil {
println(err.Error())
os.Exit(1)
}
However, in our full CLI app, the panic continues to point to the same place in the issue description, i.e.
Line 467 in c023d9b
from cli.
Cant reproduce
from cli.
Related Issues (20)
- How do I define Usage for BoolWithInverseFlag? HOT 23
- Shell completions are broken when login shell is different than currently active shell
- Use mkdocs `mike` for multi-version docs
- Strictly limit default dependencies to stdlib HOT 6
- Build out all of the v3 documentation
- Vendor usage of `github.com/xrash/smetrics` for suggestions HOT 2
- Delete stale branches HOT 5
- Use gofumpt
- Man page generation feature is not documented anywhere HOT 3
- Doc generation default value set by environment variable HOT 4
- Expose shell completions scripts in by default in the `completion` command HOT 5
- More powerful shell completion HOT 2
- Ensure `go mod tidy` works as expected HOT 1
- Target `stable` and `oldstable` in main CI
- Flags are alphabetically sorted when using categories HOT 3
- Should I expect completion of nested command's flags to work? HOT 31
- AfterFunc execution details HOT 7
- Remove [command [command options]] from help text if there are no sub commands HOT 3
- Default `cli.App.Usage` behaviour is very hard to override and leads to ugly help HOT 1
- Allow omission of default text in help text HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cli.