diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2020-04-22 00:32:55 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2020-04-22 00:32:55 -0400 |
commit | e1256ccb5a78d8cb3b4f2ab9904d80693b6959c9 (patch) | |
tree | 8af8f150e8c84bfd671e22b6bd988e96d6fc1f1c /cmd2/utils.py | |
parent | a6f04d8f8d999a1440a34307d3646a33b2b23d74 (diff) | |
download | cmd2-git-e1256ccb5a78d8cb3b4f2ab9904d80693b6959c9.tar.gz |
Updated docs
Diffstat (limited to 'cmd2/utils.py')
-rw-r--r-- | cmd2/utils.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/cmd2/utils.py b/cmd2/utils.py index 0749f32b..3fd9e3ac 100644 --- a/cmd2/utils.py +++ b/cmd2/utils.py @@ -704,6 +704,7 @@ def basic_complete(text: str, line: str, begidx: int, endidx: int, match_against class TextAlignment(Enum): + """Horizontal text alignment""" LEFT = 1 CENTER = 2 RIGHT = 3 @@ -728,8 +729,8 @@ def align_text(text: str, alignment: TextAlignment, *, fill_char: str = ' ', portions are replaced by a '…' character. Defaults to False. :return: aligned text :raises: TypeError if fill_char is more than one character (not including ANSI style sequences) - ValueError if text or fill_char contains an unprintable character - ValueError if width is less than 1 + :raises: ValueError if text or fill_char contains an unprintable character + :raises: ValueError if width is less than 1 """ import io import shutil @@ -858,8 +859,8 @@ def align_left(text: str, *, fill_char: str = ' ', width: Optional[int] = None, replaced by a '…' character. Defaults to False. :return: left-aligned text :raises: TypeError if fill_char is more than one character (not including ANSI style sequences) - ValueError if text or fill_char contains an unprintable character - ValueError if width is less than 1 + :raises: ValueError if text or fill_char contains an unprintable character + :raises: ValueError if width is less than 1 """ return align_text(text, TextAlignment.LEFT, fill_char=fill_char, width=width, tab_width=tab_width, truncate=truncate) @@ -881,8 +882,8 @@ def align_center(text: str, *, fill_char: str = ' ', width: Optional[int] = None replaced by a '…' character. Defaults to False. :return: centered text :raises: TypeError if fill_char is more than one character (not including ANSI style sequences) - ValueError if text or fill_char contains an unprintable character - ValueError if width is less than 1 + :raises: ValueError if text or fill_char contains an unprintable character + :raises: ValueError if width is less than 1 """ return align_text(text, TextAlignment.CENTER, fill_char=fill_char, width=width, tab_width=tab_width, truncate=truncate) @@ -904,8 +905,8 @@ def align_right(text: str, *, fill_char: str = ' ', width: Optional[int] = None, replaced by a '…' character. Defaults to False. :return: right-aligned text :raises: TypeError if fill_char is more than one character (not including ANSI style sequences) - ValueError if text or fill_char contains an unprintable character - ValueError if width is less than 1 + :raises: ValueError if text or fill_char contains an unprintable character + :raises: ValueError if width is less than 1 """ return align_text(text, TextAlignment.RIGHT, fill_char=fill_char, width=width, tab_width=tab_width, truncate=truncate) @@ -930,7 +931,7 @@ def truncate_line(line: str, max_width: int, *, tab_width: int = 4) -> str: :param tab_width: any tabs in the text will be replaced with this many spaces :return: line that has a display width less than or equal to width :raises: ValueError if text contains an unprintable character like a newline - ValueError if max_width is less than 1 + :raises: ValueError if max_width is less than 1 """ import io from . import ansi |