fix: verbosity flag mishandled, causes panic on valid flag
This commit is contained in:
parent
dd53df2a14
commit
e6cb20bc83
1 changed files with 3 additions and 2 deletions
5
main.go
5
main.go
|
@ -138,11 +138,12 @@ func parseArgs(args []string) Config {
|
||||||
verbosity := 0
|
verbosity := 0
|
||||||
depth := 9999
|
depth := 9999
|
||||||
|
|
||||||
|
verbosityMatchIndex := rVerboseFlag.SubexpIndex("verbosity")
|
||||||
for _, arg := range os.Args {
|
for _, arg := range os.Args {
|
||||||
verbosity_match := rVerboseFlag.FindAllString(arg, -1)
|
verbosity_match := rVerboseFlag.FindAllStringSubmatch(arg, -1)
|
||||||
|
|
||||||
if verbosity_match != nil {
|
if verbosity_match != nil {
|
||||||
verbosity = len(verbosity_match[0])
|
verbosity = len(verbosity_match[0][verbosityMatchIndex])
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue