vpype_cli.LengthType#

class LengthType(*args, **kwargs)#

click.ParamType sub-class to automatically converts a user-provided lengths into CSS pixel units.

User-provided length strings may contains units which are converted using convert_length(). Property substitution is perfomred as well.

Example:

>>> import click
>>> import vpype_cli
>>> import vpype
>>> @vpype_cli.cli.command(group="my commands")
... @click.argument("x", type=vpype_cli.LengthType())
... @click.option("-o", "--option", type=vpype_cli.LengthType(), default="1mm")
... @vpype_cli.generator
... def my_command(x: float, option: float):
...     pass

Methods

Attributes

name

the descriptive name of this type

Methods#

Attributes#

LengthType.name: str = 'length'#

the descriptive name of this type