Skip to content

-h of Subcommand does not print full information #43

@neworld

Description

@neworld

Version: 0.3.0

I have command:

class Test: Subcommand("test") {
    val input by argument(ArgType.String, "This text will be written")

    override fun execute() { }
}

If I run with the arguments test -h, it prints very little information like:

Usage: android-dev-tools test options_list

However, if I made a mistake, then it shows full documentation as error:

Usage: android-dev-tools test options_list
Arguments:
    This text will be written { String }
Options:
    --help, -h -> Usage info

        at kotlinx.cli.ArgParser.printError(ArgParser.kt:348)
        at kotlinx.cli.ArgParser.parse(ArgParser.kt:635)
        at kotlinx.cli.ArgParser.parse(ArgParser.kt:640)
        at kotlinx.cli.ArgParser.parse(ArgParser.kt:521)
        at com.vinted.devtools.android.AppKt.main(App.kt:14)

Reproduction: problem.zip

An easiest way to reproduce:

./gradlew run --args="test -h" // I am expecting full help here
./gradlew run --args="test"     // works as expected

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions