Skip to content

Commit f57b086

Browse files
committed
Added support for 8-bit/256-colors with the cmd2.EightBitFg and cmd2.EightBitBg classes.
Added support for 24-bit/RGB colors with the cmd2.RgbFg and cmd2.RgbBg classes. Removed dependency on colorama. Deprecated cmd2.fg. Use cmd2.Fg instead. Deprecated cmd2.bg. Use cmd2.Bg instead. Changed type of ansi.allow_style from a string to an ansi.AllowStyle Enum class. Fixed bug where using choices on a Settable didn't verify that a valid choice had been entered.
1 parent e35ab9c commit f57b086

29 files changed

+1373
-606
lines changed

.github/CONTRIBUTING.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ The tables below list all prerequisites along with the minimum required version
4949
| --------------------------------------------------- | --------------- |
5050
| [python](https://www.python.org/downloads/) | `3.6` |
5151
| [attrs](https://github.com/python-attrs/attrs) | `16.3` |
52-
| [colorama](https://github.com/tartley/colorama) | `0.3.7` |
5352
| [pyperclip](https://github.com/asweigart/pyperclip) | `1.6` |
5453
| [setuptools](https://pypi.org/project/setuptools/) | `34.4` |
5554
| [wcwidth](https://pypi.python.org/pypi/wcwidth) | `0.1.7` |

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
## 2.3.0 (TBD, 2021)
22
* Bug Fixes
33
* Fixed `AttributeError` in `rl_get_prompt()` when prompt is `None`.
4+
* Fixed bug where using choices on a Settable didn't verify that a valid choice had been entered.
45
* Enhancements
56
* Added settings to Column class which prevent a table from overriding existing styles in header
67
and/or data text. These were added to support nesting an AlternatingTable within an AlternatingTable,
78
but other custom table classes can also use these settings.
89
* AlternatingTable no longer applies background color to outer borders. This was done to improve appearance
910
since the background color extended beyond the borders of the table.
11+
* Added support for 8-bit/256-colors with the `cmd2.EightBitFg` and `cmd2.EightBitBg` classes.
12+
* Added support for 24-bit/RGB colors with the `cmd2.RgbFg` and `cmd2.RgbBg` classes.
13+
* Removed dependency on colorama.
14+
* Changed type of `ansi.allow_style` from a string to an `ansi.AllowStyle` Enum class.
15+
* Deprecations
16+
* Deprecated `cmd2.fg`. Use `cmd2.Fg` instead.
17+
* Deprecated `cmd2.bg`. Use `cmd2.Bg` instead.
1018

1119
## 2.2.0 (September 14, 2021)
1220
* Bug Fixes

Pipfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ verify_ssl = true
55

66
[packages]
77
attrs = ">=16.3.0"
8-
colorama = ">=0.3.7"
98
pyperclip = ">=1.6"
109
setuptools = ">=34.4"
1110
wcwidth = ">=0.1.7"
@@ -23,7 +22,6 @@ ipython = "*"
2322
isort = "*"
2423
mock = {version = "*",markers = "python_version < '3.6'"}
2524
mypy = "*"
26-
plumbum = "*"
2725
pyreadline = {version = "*",sys_platform = "== 'win32'",markers = "python_version < '3.8'"}
2826
pyreadline3 = {version = "*",sys_platform = "== 'win32'",markers = "python_version >= '3.8'"}
2927
pytest = "*"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Feature Overview
8383
----------------
8484
Instructions for implementing each feature follow.
8585

86-
- Extension of the `cmd` module. So capabilities provided by `cmd` still exist
86+
- Extension of the `cmd` module. So capabilities provided by `cmd` still exist
8787
- Your applicaiton inherits from `cmd2.Cmd`, let's say you call this class `MyApp`
8888
```Python
8989
import cmd2
@@ -95,7 +95,7 @@ Instructions for implementing each feature follow.
9595
class MyApp(cmd2.Cmd):
9696
def do_foo(self, args):
9797
"""This docstring is the built-in help for the foo command."""
98-
self.poutput(cmd2.style('foo bar baz', fg=cmd2.fg.red))
98+
self.poutput(cmd2.style('foo bar baz', fg=cmd2.Fg.RED))
9999
```
100100
- By default the docstring for your **do_foo** method is the help for the **foo** command
101101
- NOTE: This doesn't apply if you use one of the `argparse` decorators mentioned below

cmd2/__init__.py

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,19 @@
1919

2020
from typing import List
2121

22-
from .ansi import style, fg, bg
22+
from .ansi import (
23+
Cursor,
24+
Bg,
25+
Fg,
26+
EightBitBg,
27+
EightBitFg,
28+
RgbBg,
29+
RgbFg,
30+
TextStyle,
31+
bg, # DEPRECATED: Use Bg
32+
fg, # DEPRECATED: Use Fg
33+
style,
34+
)
2335
from .argparse_custom import (
2436
Cmd2ArgumentParser,
2537
Cmd2AttributeWrapper,
@@ -54,9 +66,17 @@
5466
__all__: List[str] = [
5567
'COMMAND_NAME',
5668
'DEFAULT_SHORTCUTS',
57-
# ANSI Style exports
58-
'bg',
59-
'fg',
69+
# ANSI Exports
70+
'Cursor',
71+
'Bg',
72+
'Fg',
73+
'EightBitBg',
74+
'EightBitFg',
75+
'RgbBg',
76+
'RgbFg',
77+
'TextStyle',
78+
'bg', # DEPRECATED: Use Bg
79+
'fg', # DEPRECATED: Use Fg
6080
'style',
6181
# Argparse Exports
6282
'Cmd2ArgumentParser',

0 commit comments

Comments
 (0)