std/cli/error

std/cli/src/error.trb

CliError: what is wrong with a command line. Every case names the command, spelled as the user typed it (torb check), and the argument that is wrong.

type CliError

type CliError with Show, Error

Why a command line was refused. CliError.show is the message a user reads: one line that names the command and the argument.

torb check: unknown flag '--verbos'
torb build: option '--jobs': 'many' is not an integer

case UnknownCommand

case UnknownCommand(command: String, name: String, known: List<String>)

name is none of the known subcommands of command.

case MissingCommand

case MissingCommand(command: String, known: List<String>)

command has subcommands and no handler of its own, and none was named.

case UnknownFlag

case UnknownFlag(command: String, flag: String)

flag, written with its dashes, is neither a flag nor an option of command.

case MissingValue

case MissingValue(command: String, option: String)

The option option, written with its dashes, is the last argument and has no value.

case InvalidValue

case InvalidValue(command: String, option: String, value: String, reason: String)

value is not what the option option reads: reason says why.

case ValueForFlag

case ValueForFlag(command: String, flag: String)

The flag flag was written --flag=value, and a flag takes none.

case MissingOption

case MissingOption(command: String, option: String)

The option option has no default and was left out.

case UnexpectedArgument

case UnexpectedArgument(command: String, argument: String)

command takes no positional arguments, and argument is one.

fn command

fn command(): String

The command, spelled as the user typed it: torb check.

fn show

fn show(): String

One line that names the command and the argument that is wrong.