File tree Expand file tree Collapse file tree 1 file changed +1
-4
lines changed
library/src/scala/annotation Expand file tree Collapse file tree 1 file changed +1
-4
lines changed Original file line number Diff line number Diff line change @@ -65,10 +65,7 @@ final class newMain extends MainAnnotation[FromString, Any]:
65
65
private inline val argMarker = " --"
66
66
private inline val shortArgMarker = " -"
67
67
68
- private val longArgNameRegex = " [a-zA-Z][a-zA-Z0-9]*" .r
69
68
private val longArgRegex = " --[a-zA-Z][a-zA-Z0-9]*" .r
70
-
71
- private val shortArgNameRegex = " [a-zA-Z]" .r
72
69
private val shortArgRegex = " -[a-zA-Z]" .r
73
70
74
71
extension (param : Parameter )
@@ -341,7 +338,7 @@ final class newMain extends MainAnnotation[FromString, Any]:
341
338
throw IllegalArgumentException (s " $name is used for multiple parameters: ${canonicalNames.mkString(" , " )}" )
342
339
def checkValidNames () =
343
340
def isValidArgName (name : String ): Boolean =
344
- longArgNameRegex .matches(name) || shortArgNameRegex .matches(name)
341
+ longArgRegex .matches(argMarker + name) || shortArgRegex .matches(shortArgMarker + name)
345
342
for param <- info.parameters do
346
343
if ! isValidArgName(param.name) then
347
344
throw IllegalArgumentException (s " The following argument name is invalid: ${param.name}" )
You can’t perform that action at this time.
0 commit comments