File tree Expand file tree Collapse file tree 2 files changed +26
-21
lines changed Expand file tree Collapse file tree 2 files changed +26
-21
lines changed Original file line number Diff line number Diff line change 5
5
- No longer setting parser's ` prog ` value in ` with_argparser() ` since it gets set in
6
6
` Cmd._build_parser() ` . This code had previously been restored to support backward
7
7
compatibility in ` cmd2 ` 2.0 family.
8
- - Removed ` table_creator ` module in favor of ` Rich ` tables.
8
+ - Removed table_creator.py in favor of ` Rich ` tables.
9
+ - Moved string styling functionality from ansi.py to string_utils.py.
10
+ - Moved all string-related functions from utils.py to string_utils.py.
11
+ - Removed all text style Enums from ansi.py in favor of ` Rich ` styles.
12
+ - Renamed ansi.py to terminal_utils.py to reflect the functions left in it.
9
13
10
14
- Enhancements
11
15
- Simplified the process to set a custom parser for ` cmd2's ` built-in commands. See
12
16
[ custom_parser.py] ( https://github.com/python-cmd2/cmd2/blob/main/examples/custom_parser.py )
13
17
example for more details.
14
-
15
18
- Added ` Cmd.macro_arg_complete() ` which tab completes arguments to a macro. Its default
16
19
behavior is to perform path completion, but it can be overridden as needed.
17
-
18
20
- All print methods (` poutput() ` , ` perror() ` , ` ppaged() ` , etc.) have the ability to print Rich
19
21
objects.
22
+ - Added string_utils.py which contains all string utility functions. This includes quoting and
23
+ alignment functions from utils.py. This also includes style-related functions from ansi.py.
24
+ This also includes style-related functions from ansi.py.
25
+ - Added colors.py which contains a StrEnum of all color names supported by Rich.
26
+ - Added styles.py which contains a StrEnum of all cmd2-specific style names and their respective
27
+ style definitions.
20
28
21
29
- Bug Fixes
22
30
- No longer redirecting ` sys.stdout ` if it's a different stream than ` self.stdout ` . This fixes
Original file line number Diff line number Diff line change @@ -16,26 +16,23 @@ class Color(StrEnum):
16
16
17
17
Aside from DEFAULT, these colors come from the rich.color.ANSI_COLOR_NAMES dictionary.
18
18
19
- The following colors are the 16 whose appearance is determined by the terminal.
20
- - BLACK
21
- - BLUE
22
- - BRIGHT_BLACK
23
- - BRIGHT_BLUE
24
- - BRIGHT_CYAN
25
- - BRIGHT_GREEN
26
- - BRIGHT_MAGENTA
27
- - BRIGHT_RED
28
- - BRIGHT_WHITE
29
- - BRIGHT_YELLOW
30
- - CYAN
31
- - GREEN
32
- - MAGENTA
33
- - RED
34
- - WHITE
35
- - YELLOW
19
+ Note: The terminal color settings determines the appearance of the follow 16 colors.
20
+
21
+ | | |
22
+ |----------------|---------------|
23
+ | BLACK | BRIGHT_WHITE |
24
+ | BLUE | BRIGHT_YELLOW |
25
+ | BRIGHT_BLACK | CYAN |
26
+ | BRIGHT_BLUE | GREEN |
27
+ | BRIGHT_CYAN | MAGENTA |
28
+ | BRIGHT_GREEN | RED |
29
+ | BRIGHT_MAGENTA | WHITE |
30
+ | BRIGHT_RED | YELLOW |
36
31
"""
37
32
38
- DEFAULT = "default" # Represents the terminal's default foreground or background color.
33
+ DEFAULT = "default"
34
+ """Represents the terminal's default foreground or background color."""
35
+
39
36
AQUAMARINE1 = "aquamarine1"
40
37
AQUAMARINE3 = "aquamarine3"
41
38
BLACK = "black"
You can’t perform that action at this time.
0 commit comments