Open
Description
When using multiple main methods --help
is not automatically detected if passed to a subcommand.
For example:
object Main {
@main def foo(@arg() bar: Boolean ) = {}
@main def baz() = {}
def main(args: Array[String]): Unit = ParserForMethods(this).runOrExit(args.toSeq)
}
When run with ./example foo --help
will error instead of printing the help message for foo
:
Missing argument: --bar <bool>
Unknown argument: "--help"
Expected Signature: foo
--bar <bool>
The --help
arg will also get swallowed by a Leftover[String]
or String*
and the command will run instead of immediately exiting:
object Main {
@main def foo(@arg() bar: String*) = { println(bar) }
@main def bar() = {}
def main(args: Array[String]): Unit = ParserForMethods(this).runOrExit(args.toSeq)
}
When run with ./example foo --help
outputs:
List(--help)
Metadata
Metadata
Assignees
Labels
No labels