mainargs icon indicating copy to clipboard operation
mainargs copied to clipboard

`printHelpOnExit` doesn't work for subcommands

Open scarf005 opened this issue 8 months ago • 0 comments

Reproduction

using https://github.com/com-lihaoyi/mainargs#multiple-main-methods as test.scala:

without any flags:

$ scala test.scala
Need to specify a sub command: foo, bar

with --help explicitly given:

$ scala --cli-version 1.7.1 test.scala -- --help
Available subcommands:

  foo
    --bool          Example flag
    -f --foo <str>  String to print repeatedly
    --my-num <int>  How many times to print string

  bar
    -i <int>
    -s <str>        Pass in a custom `s` to override it

Expected Behavior

printHelpOnExit: Boolean: whether or not to print the full help text when argument parsing fails. This can be convenient, but potentially very verbose if the list of arguments is long. Defaults to true

when subcommand parsing fails, the same full help message (--help) should be printed.

Additional Context

I'm interested in opening a PR.

scarf005 avatar Apr 22 '25 16:04 scarf005