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

Function shlex_split

cmd2/parsing.py:34–44  ·  view source on GitHub ↗

Split the string *str_to_split* using shell-like syntax. A wrapper around shlex.split() that uses cmd2's preferred arguments. This allows other classes to easily call split() the same way StatementParser does. :param str_to_split: the string being split :return: A list of tokens

(str_to_split: str)

Source from the content-addressed store, hash-verified

32
33
34def shlex_split(str_to_split: str) -> list[str]:
35 """Split the string *str_to_split* using shell-like syntax.
36
37 A wrapper around shlex.split() that uses cmd2's preferred arguments.
38
39 This allows other classes to easily call split() the same way StatementParser does.
40
41 :param str_to_split: the string being split
42 :return: A list of tokens
43 """
44 return shlex.split(str_to_split, comments=False, posix=False)
45
46
47@dataclass(frozen=True, slots=True)

Callers 8

single_line_formatFunction · 0.85
arg_listMethod · 0.85
tokenizeMethod · 0.85
parse_command_onlyMethod · 0.85
tokens_for_completionMethod · 0.85
_alias_listMethod · 0.85
_macro_listMethod · 0.85

Calls

no outgoing calls

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…