cli

fun <T> cli(block: () -> T): T

Runs block and turns Argot's outcomes into the usual command-line behaviour:

  • success returns the parsed value;

  • --help and --version print to stdout and exit 0;

  • invalid input prints the usage line and error: … to stderr and exits 2.

fun main(argv: Array<String>) {
val args = cli { parseServeArgs(argv) } // generated parser, or ServerArgs().parse(argv)
runServer(args)
}