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

Method _command_and_args

cmd2/parsing.py:685–696  ·  view source on GitHub ↗

Given a list of tokens, return a tuple of the command and the args as a string.

(tokens: list[str])

Source from the content-addressed store, hash-verified

683
684 @staticmethod
685 def _command_and_args(tokens: list[str]) -> tuple[str, str]:
686 """Given a list of tokens, return a tuple of the command and the args as a string."""
687 command = ""
688 args = ""
689
690 if tokens:
691 command = tokens[0]
692
693 if len(tokens) > 1:
694 args = " ".join(tokens[1:])
695
696 return command, args
697
698 def split_on_punctuation(self, tokens: list[str]) -> list[str]:
699 """Further splits tokens from a command line using punctuation characters.

Callers 2

parseMethod · 0.95
test_command_and_argsFunction · 0.80

Calls

no outgoing calls

Tested by 1

test_command_and_argsFunction · 0.64