mini_arcade.cli.argument_type

Argument Type Definitions for Mini Arcade CLI

Attributes

Classes

ArgumentType

Represents an argument for a command.

Functions

coerce_type(→ Callable[[str], DataType])

Coerce a type to a callable that converts a string to that type.

Module Contents

mini_arcade.cli.argument_type.JSON
mini_arcade.cli.argument_type.DataType
class mini_arcade.cli.argument_type.ArgumentType[source]

Represents an argument for a command.

Variables:
  • (str) (help_text) – The name of the argument.

  • (DataType) (data_type) – The data type of the argument.

  • (str) – The help text for the argument.

  • (bool) (required) – Whether the argument is required.

  • (Optional[DataType]) (default) – The default value for the argument.

  • (Optional[List[str]]) (choices) – The choices for the argument.

  • str]]) (nargs (Optional[Union[int,) – The number of arguments.

  • (Optional[str]) (env) – The metavar for the argument.

  • (Optional[str]) – The environment variable associated with the argument.

name: str
data_type: DataType
help_text: str
required: bool = False
default: DataType | None = None
choices: List[str] | None = None
nargs: int | str | None = None
metavar: str | None = None
env: str | None = None
to_dict() dict[source]

Convert the argument to a dictionary.

Returns:

The argument as a dictionary.

Return type:

dict

mini_arcade.cli.argument_type.coerce_type(t: DataType) Callable[[str], DataType][source]

Coerce a type to a callable that converts a string to that type.

Parameters:

t (DataType) – The type to coerce.

Returns:

A callable that converts a string to the specified type.

Return type:

Callable[[str], DataType]