summaryrefslogtreecommitdiff
path: root/cmd2/parsing.py
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2019-12-09 15:23:58 -0500
committerKevin Van Brunt <kmvanbrunt@gmail.com>2019-12-09 15:23:58 -0500
commitcda57dc1a1859408fb25d31178ad0f6e77ede902 (patch)
treebfc4b77d81a6d02309e875049720250a4a98f7d0 /cmd2/parsing.py
parent0aac6cee56a92bb6358106329f4f0c20e85bb7bc (diff)
downloadcmd2-git-cda57dc1a1859408fb25d31178ad0f6e77ede902.tar.gz
Updated center_text to support ansi escape sequences and characters with display widths greater than 1.
Also added left and right justification functions.
Diffstat (limited to 'cmd2/parsing.py')
-rwxr-xr-xcmd2/parsing.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/cmd2/parsing.py b/cmd2/parsing.py
index 4e690b0b..cef0b088 100755
--- a/cmd2/parsing.py
+++ b/cmd2/parsing.py
@@ -13,9 +13,10 @@ from . import utils
def shlex_split(str_to_split: str) -> List[str]:
- """A wrapper around shlex.split() that uses cmd2's preferred arguments.
+ """
+ A wrapper around shlex.split() that uses cmd2's preferred arguments.
+ This allows other classes to easily call split() the same way StatementParser does.
- 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
"""
@@ -26,8 +27,8 @@ def shlex_split(str_to_split: str) -> List[str]:
class MacroArg:
"""
Information used to replace or unescape arguments in a macro value when the macro is resolved
- Normal argument syntax : {5}
- Escaped argument syntax: {{5}}
+ Normal argument syntax: {5}
+ Escaped argument syntax: {{5}}
"""
# The starting index of this argument in the macro value
start_index = attr.ib(validator=attr.validators.instance_of(int))