Defines a cmd2 macro.
| 76 | |
| 77 | @dataclass(frozen=True, slots=True) |
| 78 | class Macro: |
| 79 | """Defines a cmd2 macro.""" |
| 80 | |
| 81 | # Name of the macro |
| 82 | name: str |
| 83 | |
| 84 | # The string the macro resolves to |
| 85 | value: str |
| 86 | |
| 87 | # The minimum number of args the user has to pass to this macro |
| 88 | minimum_arg_count: int |
| 89 | |
| 90 | # Metadata for argument placeholders and escaped sequences found in 'value'. |
| 91 | # This is stored internally as a tuple. |
| 92 | args: Sequence[MacroArg] = field(default_factory=tuple) |
| 93 | |
| 94 | def __post_init__(self) -> None: |
| 95 | """Finalize the object after initialization.""" |
| 96 | # Convert args to an immutable tuple. |
| 97 | if not isinstance(self.args, tuple): |
| 98 | object.__setattr__(self, "args", tuple(self.args)) |
| 99 | |
| 100 | |
| 101 | @dataclass(frozen=True) |
no outgoing calls
no test coverage detected
searching dependent graphs…