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][].
| 246 | |
| 247 | @dataclass(frozen=True, slots=True) |
| 248 | class 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 | |
| 281 | class StatementParser: |
no outgoing calls
no test coverage detected
searching dependent graphs…