Skip to content

Commit a8653fd

Browse files
committed
fix: make sure runEither isn't calling itself
It looks like this was overlooked and the overloaded `runEither` is just constantly calling itself resulting in a stack overflow. This changes it to call the newly created `runEither` with the `nameMapper` which I believe is the intended flow. fixes #106
1 parent d2dd9bf commit a8653fd

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

mainargs/src/Parser.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,8 @@ class ParserForMethods[B](val mains: MethodMains[B]) {
213213
autoPrintHelpAndExit,
214214
customNames,
215215
customDocs,
216-
sorted
216+
sorted,
217+
Util.kebabCaseNameMapper
217218
)
218219
@deprecated("Binary Compatibility Shim", "mainargs 0.6.0")
219220
def runRaw(

mainargs/test/src/ParserTests.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,8 @@ object ParserTests extends TestSuite {
5454
classParser.constructEither(Array("--code", "println(1)")) ==>
5555
Right(ClassBase(code = Some("println(1)"), other = "hello"))
5656
}
57+
test("simplerunOrExit") {
58+
singleMethodParser.runOrExit(Array("-i", "2")) ==> "lolslols"
59+
}
5760
}
5861
}

0 commit comments

Comments
 (0)