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

Class PartialStatement

cmd2/parsing.py:248–278  ·  view source on GitHub ↗

A partially parsed command line. This separates the command from its arguments without validating terminators, redirection, or quoted string completion. Note: Unlike [cmd2.parsing.Statement][], this is a simple data object and does not inherit from [str][].

Source from the content-addressed store, hash-verified

246
247@dataclass(frozen=True, slots=True)
248class PartialStatement:
249 """A partially parsed command line.
250
251 This separates the command from its arguments without validating
252 terminators, redirection, or quoted string completion.
253
254 Note:
255 Unlike [cmd2.parsing.Statement][], this is a simple data object
256 and does not inherit from [str][].
257
258 """
259
260 # The resolved command name (after shortcut/alias expansion)
261 command: str
262
263 # The remaining string after the command. May contain unclosed quotes
264 # or unprocessed redirection/terminator characters.
265 args: str
266
267 # The original, unmodified input string
268 raw: str
269
270 # Whether the command is recognized as a multiline-capable command
271 multiline_command: bool
272
273 @property
274 def command_and_args(self) -> str:
275 """Combine command and args with a space between them."""
276 if self.command and self.args:
277 return f"{self.command} {self.args}"
278 return self.command
279
280
281class StatementParser:

Callers 1

parse_command_onlyMethod · 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…