Skip to content

Commit f23a1c0

Browse files
committed
Improve inference precision of option
1 parent 3d90afb commit f23a1c0

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

lib/arg_parser.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@ package lib
33
import (
44
"errors"
55
"os"
6+
"regexp"
67
"strings"
78
)
89

10+
var reOpt = regexp.MustCompile("^--[a-z][-a-z]*|^-[a-zA-Z]$")
11+
912
func canOpt(arg string) bool {
10-
return strings.HasPrefix(arg, "-")
13+
return reOpt.MatchString(arg)
1114
}
1215

1316
// ParseArgs split arguments into options and file paths

0 commit comments

Comments
 (0)