openpectus.lang.exec.argument_specification

Classes

ArgSpec

Functions

command_argument(validation_spec)

Decorator to decorate a command class with an argument validation spec

command_argument_none()

Decorator for command class. Specifies that the command takes no arguments.

command_argument_regex(regex)

Decorator for command class. Specifies that the command arguments string must match

Module Contents

class openpectus.lang.exec.argument_specification.ArgSpec(regex)
NoArgsInstance: ArgSpec
NoCheckInstance: ArgSpec
regex
validate(argument)
Parameters:

argument (str)

Return type:

bool

validate_w_groups(argument)
Parameters:

argument (str)

Return type:

dict[str, str] | None

static NoArgs()

Specify that no argument must be present, not even whitespace

Return type:

ArgSpec

static NoCheck()

Specify that no argument check should be performed

Return type:

ArgSpec

static Regex(regex)

Speficy that the argument must match the given regex

Parameters:

regex (str)

Return type:

ArgSpec

__str__()
openpectus.lang.exec.argument_specification.command_argument(validation_spec)

Decorator to decorate a command class with an argument validation spec

Parameters:

validation_spec (ArgSpec)

openpectus.lang.exec.argument_specification.command_argument_none()

Decorator for command class. Specifies that the command takes no arguments.

openpectus.lang.exec.argument_specification.command_argument_regex(regex)

Decorator for command class. Specifies that the command arguments string must match the given regular expression.

Additionally, if the regex uses capture groups, the group values for a given argument can be extracted in a generic way.

Parameters:

regex (str)