Skip to content

Commit 4b620f0

Browse files
committed
Removed Cmd.parseline().
1 parent 5e2b4ac commit 4b620f0

3 files changed

Lines changed: 2 additions & 29 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ prompt is displayed.
110110
now relies exclusively on command function docstrings.
111111
- Removed `feedback_to_output` settable and changed `cmd2.Cmd.pfeedback` to always print to
112112
`self.stdout`
113+
- Removed `Cmd.parseline()` since it was unused and merely wrapped
114+
`StatementParser.parse_command_only()`.
113115
- Enhancements
114116
- New `cmd2.Cmd` parameters
115117
- **auto_suggest**: (boolean) if `True`, provide fish shell style auto-suggestions. These

cmd2/cmd2.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2883,15 +2883,6 @@ def postloop(self) -> None:
28832883
See [Hooks](../features/hooks.md) for more information.
28842884
"""
28852885

2886-
def parseline(self, line: str) -> tuple[str, str, str]:
2887-
"""Parse the line into a command name and a string containing the arguments.
2888-
2889-
:param line: line read by prompt-toolkit
2890-
:return: tuple containing (command, args, line)
2891-
"""
2892-
partial_statement = self.statement_parser.parse_command_only(line)
2893-
return partial_statement.command, partial_statement.args, partial_statement.command_and_args
2894-
28952886
def onecmd_plus_hooks(
28962887
self,
28972888
line: str,

tests/test_cmd2.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3527,26 +3527,6 @@ def test_ppretty(base_app: cmd2.Cmd) -> None:
35273527
)
35283528

35293529

3530-
# we override cmd.parseline() so we always get consistent
3531-
# command parsing by parent methods we don't override
3532-
# don't need to test all the parsing logic here, because
3533-
# parseline just calls StatementParser.parse_command_only()
3534-
def test_parseline_empty(base_app) -> None:
3535-
statement = ""
3536-
command, args, line = base_app.parseline(statement)
3537-
assert not command
3538-
assert not args
3539-
assert not line
3540-
3541-
3542-
def test_parseline_quoted(base_app) -> None:
3543-
statement = " command with 'partially completed quotes "
3544-
command, args, line = base_app.parseline(statement)
3545-
assert command == "command"
3546-
assert args == "with 'partially completed quotes "
3547-
assert line == statement.lstrip()
3548-
3549-
35503530
def test_onecmd_raw_str_continue(outsim_app) -> None:
35513531
line = "help"
35523532
stop = outsim_app.onecmd(line)

0 commit comments

Comments
 (0)