alecthomas / alecthomas/kingpin
app.Usage() ignores default command and doesn't recognize flags related to the default command.
- 主要言語
- Go
- スター
- 3.6k
- フォーク
- 279
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
``` go
package main
import (
"gopkg.in/alecthomas/kingpin.v2"
"os"
)
var (
app = kingpin.New("app", "A command line tool.")
old = app.Command("old", "").Hidden().Default()
verbose = old.Flag("verbose", "verbose mode").Hidden().Bool()
)
func main() {
kingpin.MustParse(app.Parse(os.Args[1:]))
app.Usage(os.Args[1:])
}
```
**Command**
```
go run app.go old --verbose
```
**Output**
```
usage: App old []
Flags:
--help Show context-sensitive help (also try --help-long and --help-man).
```
**Command**
```
go run app.go --verbose
```
**Output**
```
app: error: unknown long flag '--verbose'
exit status 1
```
### Expected behavior
`go run app.go --verbose` and `go run app.go old --verbose` should both display the same usage without any error as `old` is a default command.
> `app.parse` works fine as it doesn't ignore default command.
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
評価
この issue はまだ評価されていません。