MCPcopy Index your code
hub / github.com/python-cmd2/cmd2 / Macro

Class Macro

cmd2/parsing.py:78–98  ·  view source on GitHub ↗

Defines a cmd2 macro.

Source from the content-addressed store, hash-verified

76
77@dataclass(frozen=True, slots=True)
78class 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)

Callers 1

_macro_createMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…