CommandSpec

class CommandSpec(val programName: String, val description: String = "", val params: List<ParamSpec>, val version: String? = null)

Describes a command: its name, description, optional version, and parameters.

Parameters

programName

the program name shown in usage.

description

a one-line description shown at the top of --help.

params

the declared parameters, in the order they should appear in --help.

version

when set, --version is recognized and prints this string.

Constructors

Link copied to clipboard
constructor(programName: String, description: String = "", params: List<ParamSpec>, version: String? = null)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard

Renders the full --help text: description, usage line, then aligned options and arguments.

Link copied to clipboard

Renders the single-line usage string, for example Usage: serve [options] <files>....

Link copied to clipboard
fun validate()

Checks this specification for problems such as duplicate names, blank names, or a misplaced multiple positional.