Skip to content

ArgotEngine

Parses an argument list against a CommandSpec.

The engine never prints and never exits: --help and --version are reported as HelpRequested and VersionRequested, and invalid input as an ArgotParseException. Wrap a call in cli for the usual behaviour of printing those and exiting.

ArgotEngine.kt

Functions

parse

fun parse(spec: CommandSpec, argv: Array<String>): ParsedValues

Parses argv against spec.

ThrowsHelpRequested

if --help or -h is present.

ThrowsVersionRequested

if --version is present and CommandSpec.version is set.

ThrowsArgotParseException

if the input is invalid.

ThrowsIllegalArgumentException

if spec itself is malformed.

ArgotEngine.kt

Released under the Apache License 2.0.