Skip to content

Commit df0eb4a

Browse files
committed
Addressing some code review comments.
1 parent cefd93f commit df0eb4a

File tree

4 files changed

+21
-18
lines changed

4 files changed

+21
-18
lines changed

.github/CONTRIBUTING.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,19 @@ Nearly all project configuration, including for dependencies and quality tools i
6060

6161
See the `dependencies` list under the `[project]` heading in [pyproject.toml](../pyproject.toml).
6262

63-
| Prerequisite | Minimum Version | Purpose |
64-
| --------------------------------------------------- | --------------- | ---------------------------------- |
65-
| [python](https://www.python.org/downloads/) | `3.10` | Python programming language |
66-
| [pyperclip](https://github.com/asweigart/pyperclip) | `1.8` | Cross-platform clipboard functions |
63+
| Prerequisite | Minimum Version | Purpose |
64+
| -----------------------------------------------------------| --------------- | ---------------------------------- |
65+
| [python](https://www.python.org/downloads/) | `3.10` | Python programming language |
66+
| [pyperclip](https://github.com/asweigart/pyperclip) | `1.8` | Cross-platform clipboard functions |
67+
| [rich](https://github.com/Textualize/rich) | `14.1.0` | Add rich text and beautiful formatting in the terminal |
68+
| [rich-argparse](https://github.com/hamdanal/rich-argparse) | `1.7.1` | A rich-enabled help formatter for argparse |
6769

6870
> `macOS` and `Windows` each have an extra dependency to ensure they have a viable alternative to
6971
> [readline](https://tiswww.case.edu/php/chet/readline/rltop.html) available.
7072
73+
> Python 3.10 depends on [backports.strenum](https://github.com/clbarnes/backports.strenum) to use
74+
> the `enum.StrEnum` class introduced in Python 3.11.
75+
7176
#### Additional prerequisites to build and publish cmd2
7277

7378
See the `build` list under the `[dependency-groups]` heading in [pyproject.toml](../pyproject.toml)

docs/requirements.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

examples/async_printing.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
import time
99

1010
import cmd2
11-
from cmd2 import stylize
11+
from cmd2 import (
12+
Color,
13+
stylize,
14+
)
1215

1316
ALERTS = [
1417
"Watch as this application prints alerts and updates the prompt",
@@ -136,18 +139,18 @@ def _generate_colored_prompt(self) -> str:
136139
"""
137140
rand_num = random.randint(1, 20)
138141

139-
status_color = "default"
142+
status_color = Color.DEFAULT
140143

141144
if rand_num == 1:
142-
status_color = "bright_red"
145+
status_color = Color.BRIGHT_RED
143146
elif rand_num == 2:
144-
status_color = "bright_yellow"
147+
status_color = Color.BRIGHT_YELLOW
145148
elif rand_num == 3:
146-
status_color = "cyan"
149+
status_color = Color.CYAN
147150
elif rand_num == 4:
148-
status_color = "bright_green"
151+
status_color = Color.BRIGHT_GREEN
149152
elif rand_num == 5:
150-
status_color = "bright_blue"
153+
status_color = Color.BRIGHT_BLUE
151154

152155
return stylize(self.visible_prompt, style=status_color)
153156

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@ classifiers = [
2828
"Topic :: Software Development :: Libraries :: Python Modules",
2929
]
3030
dependencies = [
31+
"backports.strenum; python_version == '3.10'",
3132
"gnureadline>=8; platform_system == 'Darwin'",
3233
"pyperclip>=1.8",
3334
"pyreadline3>=3.4; platform_system == 'Windows'",
35+
"rich>=14.1.0",
3436
"rich-argparse>=1.7.1",
35-
"backports.strenum; python_version == '3.10'",
3637
]
3738

3839
[dependency-groups]

0 commit comments

Comments
 (0)