Skip to content

Commit d268a25

Browse files
committed
Updated typer version
1 parent 9ff7b96 commit d268a25

File tree

5 files changed

+84
-63
lines changed

5 files changed

+84
-63
lines changed

devcli/framework/console.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,46 @@
22

33
from rich.table import Table
44
from rich.box import SQUARE
5-
from rich import print
5+
from rich.console import Console
66
from rich import json as rjson
77

88

9-
def echo(msg: str, *args, **kwargs):
9+
def echo(msg: str, **kwargs):
1010
"""
1111
Just print a message into the terminal.
12-
It uses rich.print() which allows for color tagging like [red]message[/red].
12+
It uses rich Console which allows for color tagging like [red]message[/red].
1313
:param msg: A str with the message
1414
"""
15-
print(msg, *args, **kwargs)
15+
console = Console(soft_wrap=True, **kwargs)
16+
console.print(msg)
1617

1718

1819
def json(msg: str):
1920
"""
2021
Print a json result
2122
"""
22-
print(rjson.JSON(msg))
23+
echo(rjson.JSON(msg, ensure_ascii=True))
2324

2425

2526
def error(msg: str):
2627
"""
2728
Print a message in red
2829
"""
29-
print(f"[red]{msg}[/red]")
30+
echo(f"[red]{msg}[/red]")
3031

3132

3233
def warn(msg: str):
3334
"""
3435
Prints a message in yellow
3536
"""
36-
print(f"[yellow]{msg}[/yellow]")
37+
echo(f"[yellow]{msg}[/yellow]")
3738

3839

3940
def info(msg: str):
4041
"""
4142
Prints a message in cyan
4243
"""
43-
print(f"[cyan]{msg}[/cyan]")
44+
echo(f"[cyan]{msg}[/cyan]")
4445

4546

4647
def banner(msg: str):

devcli/utils/shell.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ def capture(command: str, cwd: str = os.curdir) -> str:
137137
result = subprocess.run(
138138
final_command, cwd=cwd, shell=True, capture_output=True, text=True
139139
)
140+
logger.debug(f"stderr: {result.stderr}")
140141
logger.debug(f"return code: {result.returncode}")
141142
return result.stdout
142143

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ requires-python = ">=3.13"
99
dependencies = [
1010
"toml>=0.10.2,<0.11",
1111
"mock>=5.1.0,<6",
12-
"typer>=0.15.1,<0.16",
12+
"typer>=0.15.1",
1313
"rich>=13.9.4,<14",
1414
"requests>=2.31.0,<3",
1515
"pyfakefs>=5.7.2,<6",

tests/test_console.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
@pytest.fixture
1010
def mock_print():
11-
with patch("devcli.framework.console.print") as mock:
11+
with patch("devcli.framework.console.echo") as mock:
1212
yield mock
1313

1414

0 commit comments

Comments
 (0)