cmd2 2.5.9__py3-none-any.whl → 2.5.10__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cmd2/ansi.py +6 -6
- cmd2/argparse_completer.py +3 -3
- cmd2/argparse_custom.py +4 -5
- cmd2/cmd2.py +11 -11
- cmd2/command_definition.py +3 -3
- cmd2/decorators.py +1 -1
- cmd2/parsing.py +2 -2
- cmd2/table_creator.py +20 -20
- cmd2/utils.py +16 -16
- {cmd2-2.5.9.dist-info → cmd2-2.5.10.dist-info}/METADATA +1 -1
- cmd2-2.5.10.dist-info/RECORD +24 -0
- cmd2-2.5.9.dist-info/RECORD +0 -24
- {cmd2-2.5.9.dist-info → cmd2-2.5.10.dist-info}/LICENSE +0 -0
- {cmd2-2.5.9.dist-info → cmd2-2.5.10.dist-info}/WHEEL +0 -0
- {cmd2-2.5.9.dist-info → cmd2-2.5.10.dist-info}/top_level.txt +0 -0
cmd2/ansi.py
CHANGED
@@ -165,7 +165,7 @@ def clear_screen(clear_type: int = 2) -> str:
|
|
165
165
|
2 - clear entire screen
|
166
166
|
3 - clear entire screen and delete all lines saved in the scrollback buffer
|
167
167
|
:return: the clear screen string
|
168
|
-
:raises
|
168
|
+
:raises ValueError: if clear_type is not a valid value
|
169
169
|
"""
|
170
170
|
if 0 <= clear_type <= 3:
|
171
171
|
return f"{CSI}{clear_type}J"
|
@@ -182,7 +182,7 @@ def clear_line(clear_type: int = 2) -> str:
|
|
182
182
|
1 - clear from cursor to beginning of the line
|
183
183
|
2 - clear entire line
|
184
184
|
:return: the clear line string
|
185
|
-
:raises
|
185
|
+
:raises ValueError: if clear_type is not a valid value
|
186
186
|
"""
|
187
187
|
if 0 <= clear_type <= 2:
|
188
188
|
return f"{CSI}{clear_type}K"
|
@@ -915,7 +915,7 @@ class RgbFg(FgColor):
|
|
915
915
|
:param r: integer from 0-255 for the red component of the color
|
916
916
|
:param g: integer from 0-255 for the green component of the color
|
917
917
|
:param b: integer from 0-255 for the blue component of the color
|
918
|
-
:raises
|
918
|
+
:raises ValueError: if r, g, or b is not in the range 0-255
|
919
919
|
"""
|
920
920
|
if any(c < 0 or c > 255 for c in [r, g, b]):
|
921
921
|
raise ValueError("RGB values must be integers in the range of 0 to 255")
|
@@ -944,7 +944,7 @@ class RgbBg(BgColor):
|
|
944
944
|
:param r: integer from 0-255 for the red component of the color
|
945
945
|
:param g: integer from 0-255 for the green component of the color
|
946
946
|
:param b: integer from 0-255 for the blue component of the color
|
947
|
-
:raises
|
947
|
+
:raises ValueError: if r, g, or b is not in the range 0-255
|
948
948
|
"""
|
949
949
|
if any(c < 0 or c > 255 for c in [r, g, b]):
|
950
950
|
raise ValueError("RGB values must be integers in the range of 0 to 255")
|
@@ -988,8 +988,8 @@ def style(
|
|
988
988
|
:param overline: apply the overline style if True. Defaults to False.
|
989
989
|
:param strikethrough: apply the strikethrough style if True. Defaults to False.
|
990
990
|
:param underline: apply the underline style if True. Defaults to False.
|
991
|
-
:raises
|
992
|
-
:raises
|
991
|
+
:raises TypeError: if fg isn't None or a subclass of FgColor
|
992
|
+
:raises TypeError: if bg isn't None or a subclass of BgColor
|
993
993
|
:return: the stylized string
|
994
994
|
"""
|
995
995
|
# List of strings that add style
|
cmd2/argparse_completer.py
CHANGED
@@ -226,7 +226,7 @@ class ArgparseCompleter:
|
|
226
226
|
:param cmd_set: if tab completing a command, the CommandSet the command's function belongs to, if applicable.
|
227
227
|
Defaults to None.
|
228
228
|
|
229
|
-
:raises
|
229
|
+
:raises CompletionError: for various types of tab completion errors
|
230
230
|
"""
|
231
231
|
if not tokens:
|
232
232
|
return []
|
@@ -264,7 +264,7 @@ class ArgparseCompleter:
|
|
264
264
|
Check if an argument belongs to a mutually exclusive group and either mark that group
|
265
265
|
as complete or print an error if the group has already been completed
|
266
266
|
:param arg_action: the action of the argument
|
267
|
-
:raises
|
267
|
+
:raises CompletionError: if the group is already completed
|
268
268
|
"""
|
269
269
|
# Check if this action is in a mutually exclusive group
|
270
270
|
for group in self._parser._mutually_exclusive_groups:
|
@@ -679,7 +679,7 @@ class ArgparseCompleter:
|
|
679
679
|
"""
|
680
680
|
Tab completion routine for an argparse argument
|
681
681
|
:return: list of completions
|
682
|
-
:raises
|
682
|
+
:raises CompletionError: if the completer or choices function this calls raises one
|
683
683
|
"""
|
684
684
|
# Check if the arg provides choices to the user
|
685
685
|
arg_choices: Union[List[str], ChoicesCallable]
|
cmd2/argparse_custom.py
CHANGED
@@ -300,7 +300,6 @@ class CompletionItem(str):
|
|
300
300
|
:param value: the value being tab completed
|
301
301
|
:param description: description text to display
|
302
302
|
:param args: args for str __init__
|
303
|
-
:param kwargs: kwargs for str __init__
|
304
303
|
"""
|
305
304
|
super().__init__(*args)
|
306
305
|
self.description = description
|
@@ -473,7 +472,7 @@ def _action_set_choices_callable(self: argparse.Action, choices_callable: Choice
|
|
473
472
|
|
474
473
|
:param self: action being edited
|
475
474
|
:param choices_callable: the ChoicesCallable instance to use
|
476
|
-
:raises
|
475
|
+
:raises TypeError: if used on incompatible action type
|
477
476
|
"""
|
478
477
|
# Verify consistent use of parameters
|
479
478
|
if self.choices is not None:
|
@@ -504,7 +503,7 @@ def _action_set_choices_provider(
|
|
504
503
|
|
505
504
|
:param self: action being edited
|
506
505
|
:param choices_provider: the choices_provider instance to use
|
507
|
-
:raises
|
506
|
+
:raises TypeError: if used on incompatible action type
|
508
507
|
"""
|
509
508
|
self._set_choices_callable(ChoicesCallable(is_completer=False, to_call=choices_provider)) # type: ignore[attr-defined]
|
510
509
|
|
@@ -525,7 +524,7 @@ def _action_set_completer(
|
|
525
524
|
|
526
525
|
:param self: action being edited
|
527
526
|
:param completer: the completer instance to use
|
528
|
-
:raises
|
527
|
+
:raises TypeError: if used on incompatible action type
|
529
528
|
"""
|
530
529
|
self._set_choices_callable(ChoicesCallable(is_completer=True, to_call=completer)) # type: ignore[attr-defined]
|
531
530
|
|
@@ -758,7 +757,7 @@ def _add_argument_wrapper(
|
|
758
757
|
See the header of this file for more information
|
759
758
|
|
760
759
|
:return: the created argument action
|
761
|
-
:raises
|
760
|
+
:raises ValueError: on incorrect parameter usage
|
762
761
|
"""
|
763
762
|
# Verify consistent use of arguments
|
764
763
|
choices_callables = [choices_provider, completer]
|
cmd2/cmd2.py
CHANGED
@@ -1134,7 +1134,7 @@ class Cmd(cmd.Cmd):
|
|
1134
1134
|
Convenience method for removing a settable parameter from ``self.settables``
|
1135
1135
|
|
1136
1136
|
:param name: name of the settable being removed
|
1137
|
-
:raises
|
1137
|
+
:raises KeyError: if the Settable matches this name
|
1138
1138
|
"""
|
1139
1139
|
try:
|
1140
1140
|
del self._settables[name]
|
@@ -2701,8 +2701,8 @@ class Cmd(cmd.Cmd):
|
|
2701
2701
|
This is used to assist in combining multiline readline history entries and is only
|
2702
2702
|
populated by cmd2. Defaults to None.
|
2703
2703
|
:return: the completed Statement
|
2704
|
-
:raises
|
2705
|
-
:raises
|
2704
|
+
:raises Cmd2ShlexError: if a shlex error occurs (e.g. No closing quotation)
|
2705
|
+
:raises EmptyStatement: when the resulting Statement is blank
|
2706
2706
|
"""
|
2707
2707
|
|
2708
2708
|
def combine_rl_history(statement: Statement) -> None:
|
@@ -2788,8 +2788,8 @@ class Cmd(cmd.Cmd):
|
|
2788
2788
|
This is used to assist in combining multiline readline history entries and is only
|
2789
2789
|
populated by cmd2. Defaults to None.
|
2790
2790
|
:return: parsed command line as a Statement
|
2791
|
-
:raises
|
2792
|
-
:raises
|
2791
|
+
:raises Cmd2ShlexError: if a shlex error occurs (e.g. No closing quotation)
|
2792
|
+
:raises EmptyStatement: when the resulting Statement is blank
|
2793
2793
|
"""
|
2794
2794
|
used_macros = []
|
2795
2795
|
orig_line = None
|
@@ -2879,7 +2879,7 @@ class Cmd(cmd.Cmd):
|
|
2879
2879
|
|
2880
2880
|
:param statement: a parsed statement from the user
|
2881
2881
|
:return: A bool telling if an error occurred and a utils.RedirectionSavedState object
|
2882
|
-
:raises
|
2882
|
+
:raises RedirectionError: if an error occurs trying to pipe or redirect
|
2883
2883
|
"""
|
2884
2884
|
import io
|
2885
2885
|
import subprocess
|
@@ -3135,7 +3135,7 @@ class Cmd(cmd.Cmd):
|
|
3135
3135
|
:param parser: an argument parser which supports the tab completion of multiple arguments
|
3136
3136
|
|
3137
3137
|
:return: the line read from stdin with all trailing new lines removed
|
3138
|
-
:raises: any exceptions raised by input() and stdin.readline()
|
3138
|
+
:raises Exception: any exceptions raised by input() and stdin.readline()
|
3139
3139
|
"""
|
3140
3140
|
readline_configured = False
|
3141
3141
|
saved_completer: Optional[CompleterFunc] = None
|
@@ -3260,7 +3260,7 @@ class Cmd(cmd.Cmd):
|
|
3260
3260
|
|
3261
3261
|
:param prompt: prompt to display to user
|
3262
3262
|
:return: command line text of 'eof' if an EOFError was caught
|
3263
|
-
:raises: whatever exceptions are raised by input() except for EOFError
|
3263
|
+
:raises Exception: whatever exceptions are raised by input() except for EOFError
|
3264
3264
|
"""
|
3265
3265
|
try:
|
3266
3266
|
# Wrap in try since terminal_lock may not be locked
|
@@ -5080,7 +5080,7 @@ class Cmd(cmd.Cmd):
|
|
5080
5080
|
Run a text editor and optionally open a file with it
|
5081
5081
|
|
5082
5082
|
:param file_path: optional path of the file to edit. Defaults to None.
|
5083
|
-
:raises
|
5083
|
+
:raises EnvironmentError: if self.editor is not set
|
5084
5084
|
"""
|
5085
5085
|
if not self.editor:
|
5086
5086
|
raise EnvironmentError("Please use 'set editor' to specify your text editing program of choice.")
|
@@ -5515,9 +5515,9 @@ class Cmd(cmd.Cmd):
|
|
5515
5515
|
"""
|
5516
5516
|
Report when a disabled command has been run or had help called on it
|
5517
5517
|
|
5518
|
-
:param
|
5518
|
+
:param _args: not used
|
5519
5519
|
:param message_to_print: the message reporting that the command is disabled
|
5520
|
-
:param
|
5520
|
+
:param _kwargs: not used
|
5521
5521
|
"""
|
5522
5522
|
# Set apply_style to False so message_to_print's style is not overridden
|
5523
5523
|
self.perror(message_to_print, apply_style=False)
|
cmd2/command_definition.py
CHANGED
@@ -114,7 +114,7 @@ class CommandSet(object):
|
|
114
114
|
Override this property if you need to change its return type to a
|
115
115
|
child class of Cmd.
|
116
116
|
|
117
|
-
:raises
|
117
|
+
:raises CommandSetRegistrationError: if CommandSet is not registered.
|
118
118
|
"""
|
119
119
|
if self.__cmd_internal is None:
|
120
120
|
raise CommandSetRegistrationError('This CommandSet is not registered')
|
@@ -127,7 +127,7 @@ class CommandSet(object):
|
|
127
127
|
requiring access to the Cmd object (e.g. configure commands and their parsers based on CLI state data).
|
128
128
|
|
129
129
|
:param cmd: The cmd2 main application
|
130
|
-
:raises
|
130
|
+
:raises CommandSetRegistrationError: if CommandSet is already registered.
|
131
131
|
"""
|
132
132
|
if self.__cmd_internal is None:
|
133
133
|
self.__cmd_internal = cmd
|
@@ -185,7 +185,7 @@ class CommandSet(object):
|
|
185
185
|
Convenience method for removing a settable parameter from the CommandSet
|
186
186
|
|
187
187
|
:param name: name of the settable being removed
|
188
|
-
:raises
|
188
|
+
:raises KeyError: if the Settable matches this name
|
189
189
|
"""
|
190
190
|
try:
|
191
191
|
del self._settables[name]
|
cmd2/decorators.py
CHANGED
@@ -354,7 +354,7 @@ def with_argparser(
|
|
354
354
|
contiguously somewhere in the list
|
355
355
|
:param kwargs: any keyword arguments being passed to command function
|
356
356
|
:return: return value of command function
|
357
|
-
:raises
|
357
|
+
:raises Cmd2ArgparseError: if argparse has error parsing command line
|
358
358
|
"""
|
359
359
|
cmd2_app, statement_arg = _parse_positionals(args)
|
360
360
|
statement, parsed_arglist = cmd2_app.statement_parser.get_command_arg_list(
|
cmd2/parsing.py
CHANGED
@@ -376,7 +376,7 @@ class StatementParser:
|
|
376
376
|
|
377
377
|
:param line: the command line being lexed
|
378
378
|
:return: A list of tokens
|
379
|
-
:raises
|
379
|
+
:raises Cmd2ShlexError: if a shlex error occurs (e.g. No closing quotation)
|
380
380
|
"""
|
381
381
|
|
382
382
|
# expand shortcuts and aliases
|
@@ -404,7 +404,7 @@ class StatementParser:
|
|
404
404
|
|
405
405
|
:param line: the command line being parsed
|
406
406
|
:return: a new [cmd2.parsing.Statement][] object
|
407
|
-
:raises
|
407
|
+
:raises Cmd2ShlexError: if a shlex error occurs (e.g. No closing quotation)
|
408
408
|
"""
|
409
409
|
|
410
410
|
# handle the special case/hardcoded terminator of a blank line
|
cmd2/table_creator.py
CHANGED
@@ -92,8 +92,8 @@ class Column:
|
|
92
92
|
(defaults to True)
|
93
93
|
:param max_data_lines: maximum lines allowed in a data cell. If line count exceeds this, then the final
|
94
94
|
line displayed will be truncated with an ellipsis. (defaults to INFINITY)
|
95
|
-
:raises
|
96
|
-
:raises
|
95
|
+
:raises ValueError: if width is less than 1
|
96
|
+
:raises ValueError: if max_data_lines is less than 1
|
97
97
|
"""
|
98
98
|
self.header = header
|
99
99
|
|
@@ -138,7 +138,7 @@ class TableCreator:
|
|
138
138
|
:param cols: column definitions for this table
|
139
139
|
:param tab_width: all tabs will be replaced with this many spaces. If a row's fill_char is a tab,
|
140
140
|
then it will be converted to one space.
|
141
|
-
:raises
|
141
|
+
:raises ValueError: if tab_width is less than 1
|
142
142
|
"""
|
143
143
|
if tab_width < 1:
|
144
144
|
raise ValueError("Tab width cannot be less than 1")
|
@@ -443,9 +443,9 @@ class TableCreator:
|
|
443
443
|
:param post_line: string to print after each line of a row. This can be used for padding after
|
444
444
|
the last cell's text and a right row border. (Defaults to blank)
|
445
445
|
:return: row string
|
446
|
-
:raises
|
447
|
-
:raises
|
448
|
-
:raises
|
446
|
+
:raises ValueError: if row_data isn't the same length as self.cols
|
447
|
+
:raises TypeError: if fill_char is more than one character (not including ANSI style sequences)
|
448
|
+
:raises ValueError: if fill_char, pre_line, inter_cell, or post_line contains an unprintable
|
449
449
|
character like a newline
|
450
450
|
"""
|
451
451
|
|
@@ -570,10 +570,10 @@ class SimpleTable(TableCreator):
|
|
570
570
|
want a divider row. Defaults to dash. (Cannot be a line breaking character)
|
571
571
|
:param header_bg: optional background color for header cells (defaults to None)
|
572
572
|
:param data_bg: optional background color for data cells (defaults to None)
|
573
|
-
:raises
|
574
|
-
:raises
|
575
|
-
:raises
|
576
|
-
:raises
|
573
|
+
:raises ValueError: if tab_width is less than 1
|
574
|
+
:raises ValueError: if column_spacing is less than 0
|
575
|
+
:raises TypeError: if divider_char is longer than one character
|
576
|
+
:raises ValueError: if divider_char is an unprintable character
|
577
577
|
"""
|
578
578
|
super().__init__(cols, tab_width=tab_width)
|
579
579
|
|
@@ -626,8 +626,8 @@ class SimpleTable(TableCreator):
|
|
626
626
|
:param num_cols: how many columns the table will have
|
627
627
|
:param column_spacing: how many spaces to place between columns. Defaults to 2.
|
628
628
|
:return: base width
|
629
|
-
:raises
|
630
|
-
:raises
|
629
|
+
:raises ValueError: if column_spacing is less than 0
|
630
|
+
:raises ValueError: if num_cols is less than 1
|
631
631
|
"""
|
632
632
|
if num_cols < 1:
|
633
633
|
raise ValueError("Column count cannot be less than 1")
|
@@ -685,7 +685,7 @@ class SimpleTable(TableCreator):
|
|
685
685
|
|
686
686
|
:param row_data: data with an entry for each column in the row
|
687
687
|
:return: data row string
|
688
|
-
:raises
|
688
|
+
:raises ValueError: if row_data isn't the same length as self.cols
|
689
689
|
"""
|
690
690
|
if len(row_data) != len(self.cols):
|
691
691
|
raise ValueError("Length of row_data must match length of cols")
|
@@ -712,7 +712,7 @@ class SimpleTable(TableCreator):
|
|
712
712
|
:param include_header: If True, then a header will be included at top of table. (Defaults to True)
|
713
713
|
:param row_spacing: A number 0 or greater specifying how many blank lines to place between
|
714
714
|
each row (Defaults to 1)
|
715
|
-
:raises
|
715
|
+
:raises ValueError: if row_spacing is less than 0
|
716
716
|
"""
|
717
717
|
if row_spacing < 0:
|
718
718
|
raise ValueError("Row spacing cannot be less than 0")
|
@@ -771,8 +771,8 @@ class BorderedTable(TableCreator):
|
|
771
771
|
:param border_bg: optional background color for borders (defaults to None)
|
772
772
|
:param header_bg: optional background color for header cells (defaults to None)
|
773
773
|
:param data_bg: optional background color for data cells (defaults to None)
|
774
|
-
:raises
|
775
|
-
:raises
|
774
|
+
:raises ValueError: if tab_width is less than 1
|
775
|
+
:raises ValueError: if padding is less than 0
|
776
776
|
"""
|
777
777
|
super().__init__(cols, tab_width=tab_width)
|
778
778
|
self.empty_data = [EMPTY] * len(self.cols)
|
@@ -827,7 +827,7 @@ class BorderedTable(TableCreator):
|
|
827
827
|
:param column_borders: if True, borders between columns will be included in the calculation (Defaults to True)
|
828
828
|
:param padding: number of spaces between text and left/right borders of cell
|
829
829
|
:return: base width
|
830
|
-
:raises
|
830
|
+
:raises ValueError: if num_cols is less than 1
|
831
831
|
"""
|
832
832
|
if num_cols < 1:
|
833
833
|
raise ValueError("Column count cannot be less than 1")
|
@@ -976,7 +976,7 @@ class BorderedTable(TableCreator):
|
|
976
976
|
|
977
977
|
:param row_data: data with an entry for each column in the row
|
978
978
|
:return: data row string
|
979
|
-
:raises
|
979
|
+
:raises ValueError: if row_data isn't the same length as self.cols
|
980
980
|
"""
|
981
981
|
if len(row_data) != len(self.cols):
|
982
982
|
raise ValueError("Length of row_data must match length of cols")
|
@@ -1077,8 +1077,8 @@ class AlternatingTable(BorderedTable):
|
|
1077
1077
|
:param header_bg: optional background color for header cells (defaults to None)
|
1078
1078
|
:param odd_bg: optional background color for odd numbered data rows (defaults to None)
|
1079
1079
|
:param even_bg: optional background color for even numbered data rows (defaults to StdBg.DARK_GRAY)
|
1080
|
-
:raises
|
1081
|
-
:raises
|
1080
|
+
:raises ValueError: if tab_width is less than 1
|
1081
|
+
:raises ValueError: if padding is less than 0
|
1082
1082
|
"""
|
1083
1083
|
super().__init__(
|
1084
1084
|
cols,
|
cmd2/utils.py
CHANGED
@@ -101,7 +101,7 @@ def to_bool(val: Any) -> bool:
|
|
101
101
|
|
102
102
|
:param val: value being converted
|
103
103
|
:return: boolean value expressed in the passed in value
|
104
|
-
:raises
|
104
|
+
:raises ValueError: if the string does not contain a value corresponding to a boolean value
|
105
105
|
"""
|
106
106
|
if isinstance(val, str):
|
107
107
|
if val.capitalize() == str(True):
|
@@ -209,7 +209,7 @@ def is_text_file(file_path: str) -> bool:
|
|
209
209
|
|
210
210
|
:param file_path: path to the file being checked
|
211
211
|
:return: True if the file is a non-empty text file, otherwise False
|
212
|
-
:raises OSError if file can't be read
|
212
|
+
:raises OSError: if file can't be read
|
213
213
|
"""
|
214
214
|
import codecs
|
215
215
|
|
@@ -858,9 +858,9 @@ def align_text(
|
|
858
858
|
:param truncate: if True, then each line will be shortened to fit within the display width. The truncated
|
859
859
|
portions are replaced by a '…' character. Defaults to False.
|
860
860
|
:return: aligned text
|
861
|
-
:raises
|
862
|
-
:raises
|
863
|
-
:raises
|
861
|
+
:raises TypeError: if fill_char is more than one character (not including ANSI style sequences)
|
862
|
+
:raises ValueError: if text or fill_char contains an unprintable character
|
863
|
+
:raises ValueError: if width is less than 1
|
864
864
|
"""
|
865
865
|
import io
|
866
866
|
import shutil
|
@@ -982,9 +982,9 @@ def align_left(
|
|
982
982
|
:param truncate: if True, then text will be shortened to fit within the display width. The truncated portion is
|
983
983
|
replaced by a '…' character. Defaults to False.
|
984
984
|
:return: left-aligned text
|
985
|
-
:raises
|
986
|
-
:raises
|
987
|
-
:raises
|
985
|
+
:raises TypeError: if fill_char is more than one character (not including ANSI style sequences)
|
986
|
+
:raises ValueError: if text or fill_char contains an unprintable character
|
987
|
+
:raises ValueError: if width is less than 1
|
988
988
|
"""
|
989
989
|
return align_text(text, TextAlignment.LEFT, fill_char=fill_char, width=width, tab_width=tab_width, truncate=truncate)
|
990
990
|
|
@@ -1005,9 +1005,9 @@ def align_center(
|
|
1005
1005
|
:param truncate: if True, then text will be shortened to fit within the display width. The truncated portion is
|
1006
1006
|
replaced by a '…' character. Defaults to False.
|
1007
1007
|
:return: centered text
|
1008
|
-
:raises
|
1009
|
-
:raises
|
1010
|
-
:raises
|
1008
|
+
:raises TypeError: if fill_char is more than one character (not including ANSI style sequences)
|
1009
|
+
:raises ValueError: if text or fill_char contains an unprintable character
|
1010
|
+
:raises ValueError: if width is less than 1
|
1011
1011
|
"""
|
1012
1012
|
return align_text(text, TextAlignment.CENTER, fill_char=fill_char, width=width, tab_width=tab_width, truncate=truncate)
|
1013
1013
|
|
@@ -1028,9 +1028,9 @@ def align_right(
|
|
1028
1028
|
:param truncate: if True, then text will be shortened to fit within the display width. The truncated portion is
|
1029
1029
|
replaced by a '…' character. Defaults to False.
|
1030
1030
|
:return: right-aligned text
|
1031
|
-
:raises
|
1032
|
-
:raises
|
1033
|
-
:raises
|
1031
|
+
:raises TypeError: if fill_char is more than one character (not including ANSI style sequences)
|
1032
|
+
:raises ValueError: if text or fill_char contains an unprintable character
|
1033
|
+
:raises ValueError: if width is less than 1
|
1034
1034
|
"""
|
1035
1035
|
return align_text(text, TextAlignment.RIGHT, fill_char=fill_char, width=width, tab_width=tab_width, truncate=truncate)
|
1036
1036
|
|
@@ -1053,8 +1053,8 @@ def truncate_line(line: str, max_width: int, *, tab_width: int = 4) -> str:
|
|
1053
1053
|
:param max_width: the maximum display width the resulting string is allowed to have
|
1054
1054
|
:param tab_width: any tabs in the text will be replaced with this many spaces
|
1055
1055
|
:return: line that has a display width less than or equal to width
|
1056
|
-
:raises
|
1057
|
-
:raises
|
1056
|
+
:raises ValueError: if text contains an unprintable character like a newline
|
1057
|
+
:raises ValueError: if max_width is less than 1
|
1058
1058
|
"""
|
1059
1059
|
import io
|
1060
1060
|
|
@@ -0,0 +1,24 @@
|
|
1
|
+
cmd2/__init__.py,sha256=C6IHJ_uHgkqejuRwA10IK0-OzPxHKyZbPn82nMUwn-A,2602
|
2
|
+
cmd2/ansi.py,sha256=nKpnciNvebb9FG0VLfs4yRfq9H49DI27flLoRBMscSo,32036
|
3
|
+
cmd2/argparse_completer.py,sha256=M2D1dnc-2SfjzPUUXpBUcD3EJpT34qSsk9ekQtQFOXs,36505
|
4
|
+
cmd2/argparse_custom.py,sha256=DqRehL5bEiz5FAQAa1aG2mj3vs91pgeYEtADo_NiEgE,57642
|
5
|
+
cmd2/clipboard.py,sha256=7EISono76d7djj17hbvR9cCTB7jVGSBkUjgVQiMyUjE,549
|
6
|
+
cmd2/cmd2.py,sha256=VWc-AN_3EYucH5WxrQZpJXxZmQNY25ORnueDhzGosVE,261112
|
7
|
+
cmd2/command_definition.py,sha256=g0BWrzQSOrWwvO1BbH5I8yNKNnvYLlXqL9ooKbDaUNY,7655
|
8
|
+
cmd2/constants.py,sha256=DioxETv-_HzcMUnjuPyz7Cqw4YEt_MTrzOMotiHj-Jo,1981
|
9
|
+
cmd2/decorators.py,sha256=agpCAUqeOhT0PFvYSJ7FNPcccZQntZLw2KAmLAF2AEY,20261
|
10
|
+
cmd2/exceptions.py,sha256=DwX7rQmon4eRyX1ZK4yne4lObdPO1j5Agg3Bav6pXwU,3600
|
11
|
+
cmd2/history.py,sha256=4iFi0Bny1CTjMx0ByQplrElvlZcus3lUgj2IyBfvAf0,14988
|
12
|
+
cmd2/parsing.py,sha256=uVWU_-WEZ_aow5IX9ktbVSE2WB_N86dY0D-GK8kzOhw,28297
|
13
|
+
cmd2/plugin.py,sha256=CCzzuHeBQbxH7YuG3UCdQ0uArnKYbodjhj-sYCbXSa0,814
|
14
|
+
cmd2/py.typed,sha256=qrkHrYJvGoZpU2BpVLNxJB44LlhqVSKyYOwD_L_1m3s,10
|
15
|
+
cmd2/py_bridge.py,sha256=DJCa7ff-XLwcz7Ij47nrwxgDDVUIVS5bRReLmayok1Q,5016
|
16
|
+
cmd2/rl_utils.py,sha256=HVPdNjuYyU67-XerPUJArmzhohzI1ABrZhU9cLc-EIs,11538
|
17
|
+
cmd2/table_creator.py,sha256=D9HgHaCu66ueCQRI7YIrdCX2g7Ow9hYN3Dj8gRJhXxs,47544
|
18
|
+
cmd2/transcript.py,sha256=I0sD38RbG79Qz9GXIlfh1pHSNmWBTY2SLZAKEdSLWI4,9182
|
19
|
+
cmd2/utils.py,sha256=50iSIHSenAmpBTefE0_32wT0CM9U5GdT5q4aX8mtzjM,49367
|
20
|
+
cmd2-2.5.10.dist-info/LICENSE,sha256=QXrW0Z0merk9mncyUkn-sgRxhT8_o1dL5HEaBNH47Q4,1099
|
21
|
+
cmd2-2.5.10.dist-info/METADATA,sha256=HrBCCwsip1J1m09TS9BXQfYrLTFTfX3PolKu3aaOwoM,17104
|
22
|
+
cmd2-2.5.10.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
23
|
+
cmd2-2.5.10.dist-info/top_level.txt,sha256=gJbOJmyrARwLhm5diXAtzlNQdxbDZ8iRJ8HJi65_5hg,5
|
24
|
+
cmd2-2.5.10.dist-info/RECORD,,
|
cmd2-2.5.9.dist-info/RECORD
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
cmd2/__init__.py,sha256=C6IHJ_uHgkqejuRwA10IK0-OzPxHKyZbPn82nMUwn-A,2602
|
2
|
-
cmd2/ansi.py,sha256=_3gAbMgqh8ksg43N2xQLp2u8uoB81BUl3CFoBN0990I,32036
|
3
|
-
cmd2/argparse_completer.py,sha256=6z0zmODqM7vhQhI0c6JUvCmR2V4qfdWQEyTZeNIea8c,36505
|
4
|
-
cmd2/argparse_custom.py,sha256=eZS-PodcF-UqhclKr61Wy0KXLRHM382Tk4T7mzlaWko,57689
|
5
|
-
cmd2/clipboard.py,sha256=7EISono76d7djj17hbvR9cCTB7jVGSBkUjgVQiMyUjE,549
|
6
|
-
cmd2/cmd2.py,sha256=GRIBAdRtDs2fXcUkE-IMaKIRLHV2slNbKTyPFq8QMHw,261090
|
7
|
-
cmd2/command_definition.py,sha256=OscFEk-O2N20fb8_fhkczqclaCxOwYyxNTnXWXOlngg,7655
|
8
|
-
cmd2/constants.py,sha256=DioxETv-_HzcMUnjuPyz7Cqw4YEt_MTrzOMotiHj-Jo,1981
|
9
|
-
cmd2/decorators.py,sha256=QVRyGQmAM6YBUhlZHqEVAvt9Tn1NqKGeSjDrLoUHvJg,20261
|
10
|
-
cmd2/exceptions.py,sha256=DwX7rQmon4eRyX1ZK4yne4lObdPO1j5Agg3Bav6pXwU,3600
|
11
|
-
cmd2/history.py,sha256=4iFi0Bny1CTjMx0ByQplrElvlZcus3lUgj2IyBfvAf0,14988
|
12
|
-
cmd2/parsing.py,sha256=58gD8hSvSV3nCliyoEZXJbvbzbnJ_5mSnwhTQhMM0BI,28297
|
13
|
-
cmd2/plugin.py,sha256=CCzzuHeBQbxH7YuG3UCdQ0uArnKYbodjhj-sYCbXSa0,814
|
14
|
-
cmd2/py.typed,sha256=qrkHrYJvGoZpU2BpVLNxJB44LlhqVSKyYOwD_L_1m3s,10
|
15
|
-
cmd2/py_bridge.py,sha256=DJCa7ff-XLwcz7Ij47nrwxgDDVUIVS5bRReLmayok1Q,5016
|
16
|
-
cmd2/rl_utils.py,sha256=HVPdNjuYyU67-XerPUJArmzhohzI1ABrZhU9cLc-EIs,11538
|
17
|
-
cmd2/table_creator.py,sha256=qoxt9s3MxQkfSkp4cIPFMlVzC7kRjUU55p0ow7pFQus,47544
|
18
|
-
cmd2/transcript.py,sha256=I0sD38RbG79Qz9GXIlfh1pHSNmWBTY2SLZAKEdSLWI4,9182
|
19
|
-
cmd2/utils.py,sha256=TElD9YnN5yT7BNuUcKSLpqRLcxrVmx_etkKHETFxRWU,49366
|
20
|
-
cmd2-2.5.9.dist-info/LICENSE,sha256=QXrW0Z0merk9mncyUkn-sgRxhT8_o1dL5HEaBNH47Q4,1099
|
21
|
-
cmd2-2.5.9.dist-info/METADATA,sha256=l1ODgTmFJO7C1Lgro-FIdGMldbIOCHrvmilsRCSUml8,17103
|
22
|
-
cmd2-2.5.9.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
23
|
-
cmd2-2.5.9.dist-info/top_level.txt,sha256=gJbOJmyrARwLhm5diXAtzlNQdxbDZ8iRJ8HJi65_5hg,5
|
24
|
-
cmd2-2.5.9.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|