usecli 0.2.3__tar.gz → 0.2.5__tar.gz
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.
- {usecli-0.2.3 → usecli-0.2.5}/PKG-INFO +1 -1
- {usecli-0.2.3 → usecli-0.2.5}/pyproject.toml +1 -1
- {usecli-0.2.3 → usecli-0.2.5}/pyproject.toml.orig +1 -1
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/__init__.py +12 -2
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/commands/defaults/base/about_command.py +25 -2
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/commands/defaults/base/internal/interactive_command.py +42 -39
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/core/_typer_compat.py +21 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/core/exceptions/usage.py +32 -3
- {usecli-0.2.3 → usecli-0.2.5}/LICENSE +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/README.md +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/bundler/__init__.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/bundler/__main__.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/__init__.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/commands/README.md +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/commands/__init__.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/commands/custom/README.md +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/commands/custom/__init__.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/commands/defaults/__init__.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/commands/defaults/base/__init__.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/commands/defaults/base/help_command.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/commands/defaults/base/inspire_command.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/commands/defaults/base/internal/__init__.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/commands/defaults/base/upgrade_command.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/commands/defaults/core/__init__.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/commands/defaults/core/utils.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/commands/defaults/make/__init__.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/commands/defaults/make/make_bundle_command.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/commands/defaults/make/make_command.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/commands/defaults/make/make_theme_command.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/commands/init_command.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/config/__init__.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/config/colors.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/core/__init__.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/core/base_command.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/core/error/__init__.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/core/error/handler.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/core/error/utils.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/core/exceptions/__init__.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/core/exceptions/base.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/core/exceptions/config.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/core/exceptions/validation.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/core/runtime.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/core/ui/__init__.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/core/ui/list.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/core/ui/title.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/core/ui/title.txt +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/core/validators/__init__.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/core/validators/network.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/core/validators/numeric.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/core/validators/path.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/core/validators/string.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/services/__init__.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/services/command_service.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/templates/command.py.j2 +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/templates/theme.toml.j2 +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/templates/usecli.config.toml.j2 +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/themes/ayu_dark.toml +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/themes/catppuccin_frappe.toml +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/themes/catppuccin_latte.toml +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/themes/catppuccin_macchiato.toml +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/themes/catppuccin_mocha.toml +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/themes/default.toml +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/themes/dracula.toml +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/themes/gruvbox_dark.toml +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/themes/nord.toml +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/themes/tokyo_night.toml +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/utils/__init__.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/utils/interactive/__init__.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/utils/interactive/prompt_input.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/utils/interactive/terminal_menu.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/entry.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/menu.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/params.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/progress.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/shared/__init__.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/shared/config/__init__.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/shared/config/globals.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/shared/config/manager.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/shared/upgrades/__init__.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/shared/upgrades/checker.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/shared/upgrades/discovery.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/shared/upgrades/installer.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/shared/upgrades/pyproject.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/shared/upgrades/service.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/shared/upgrades/settings.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/ui.py +0 -0
- {usecli-0.2.3 → usecli-0.2.5}/src/usecli/usecli.config.toml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "usecli"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.5"
|
|
4
4
|
description = "A powerful Python CLI framework for building beautiful, developer-friendly command-line tools."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = [{ name = "Edward Boswell", email = "thememium@gmail.com" }]
|
|
@@ -297,7 +297,12 @@ def _ensure_cli_initialized() -> None:
|
|
|
297
297
|
except _TyperBadParameter as e:
|
|
298
298
|
from usecli.cli.core.exceptions import UsecliBadParameter
|
|
299
299
|
|
|
300
|
-
styled_error = UsecliBadParameter(
|
|
300
|
+
styled_error = UsecliBadParameter(
|
|
301
|
+
e.message,
|
|
302
|
+
ctx=e.ctx,
|
|
303
|
+
param=e.param,
|
|
304
|
+
formatted_message=e.format_message(),
|
|
305
|
+
)
|
|
301
306
|
styled_error.show()
|
|
302
307
|
sys.exit(styled_error.exit_code)
|
|
303
308
|
except _TyperUsageError as e:
|
|
@@ -627,7 +632,12 @@ def main() -> None:
|
|
|
627
632
|
except _TyperBadParameter as e:
|
|
628
633
|
from usecli.cli.core.exceptions import UsecliBadParameter
|
|
629
634
|
|
|
630
|
-
styled_error = UsecliBadParameter(
|
|
635
|
+
styled_error = UsecliBadParameter(
|
|
636
|
+
e.message,
|
|
637
|
+
ctx=e.ctx,
|
|
638
|
+
param=e.param,
|
|
639
|
+
formatted_message=e.format_message(),
|
|
640
|
+
)
|
|
631
641
|
styled_error.show()
|
|
632
642
|
sys.exit(styled_error.exit_code)
|
|
633
643
|
except _TyperUsageError as e:
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import os
|
|
4
|
+
import re
|
|
4
5
|
import sys
|
|
5
6
|
import tomllib
|
|
6
7
|
from importlib.metadata import PackageNotFoundError
|
|
8
|
+
from importlib.metadata import version as get_version
|
|
7
9
|
from pathlib import Path
|
|
8
10
|
|
|
9
11
|
from usecli.cli.config.colors import COLOR
|
|
@@ -66,6 +68,22 @@ def _parse_dependency_requirement(req: str) -> tuple[str, str | None]:
|
|
|
66
68
|
return name, remainder
|
|
67
69
|
|
|
68
70
|
|
|
71
|
+
def _is_extra_requirement(req: str) -> bool:
|
|
72
|
+
"""True when the requirement's marker gates it behind an optional extra."""
|
|
73
|
+
_, sep, marker = req.partition(";")
|
|
74
|
+
if not sep:
|
|
75
|
+
return False
|
|
76
|
+
return re.search(r"\bextra\b", marker) is not None
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def _is_dependency_installed(name: str) -> bool:
|
|
80
|
+
try:
|
|
81
|
+
get_version(name)
|
|
82
|
+
except (PackageNotFoundError, OSError):
|
|
83
|
+
return False
|
|
84
|
+
return True
|
|
85
|
+
|
|
86
|
+
|
|
69
87
|
def _get_console_script_distribution(command_name: str | None):
|
|
70
88
|
if not command_name:
|
|
71
89
|
return None
|
|
@@ -81,8 +99,13 @@ def _get_package_dependencies_from_distribution(dist) -> list[tuple[str, str | N
|
|
|
81
99
|
if not isinstance(req, str):
|
|
82
100
|
continue
|
|
83
101
|
name, spec = _parse_dependency_requirement(req)
|
|
84
|
-
if name
|
|
85
|
-
|
|
102
|
+
if not name or req.startswith("("):
|
|
103
|
+
continue
|
|
104
|
+
# ``dist.requires`` includes extra-gated requirements. Those are
|
|
105
|
+
# optional, so only list them when they are actually installed.
|
|
106
|
+
if _is_extra_requirement(req) and not _is_dependency_installed(name):
|
|
107
|
+
continue
|
|
108
|
+
result.append((name, spec))
|
|
86
109
|
return result
|
|
87
110
|
|
|
88
111
|
|
{usecli-0.2.3 → usecli-0.2.5}/src/usecli/cli/commands/defaults/base/internal/interactive_command.py
RENAMED
|
@@ -283,6 +283,33 @@ def _get_group_subcommands(
|
|
|
283
283
|
return subcommands
|
|
284
284
|
|
|
285
285
|
|
|
286
|
+
def _prompt_for_text(prompt_text: str, empty_message: str) -> str:
|
|
287
|
+
"""Read a non-empty value through rich's prompt-toolkit input seam.
|
|
288
|
+
|
|
289
|
+
``console.input`` is patched by
|
|
290
|
+
:func:`usecli.cli.utils.interactive.prompt_input.install_prompt_input`, so
|
|
291
|
+
cursor keys, editing and history work instead of reaching a raw
|
|
292
|
+
``input()``.
|
|
293
|
+
"""
|
|
294
|
+
value = ""
|
|
295
|
+
while not value:
|
|
296
|
+
try:
|
|
297
|
+
value = console.input(
|
|
298
|
+
f"[bold {COLOR.SECONDARY}]{prompt_text}[/bold {COLOR.SECONDARY}]\n"
|
|
299
|
+
f"[bold {COLOR.SECONDARY}]└─> [/bold {COLOR.SECONDARY}]"
|
|
300
|
+
).strip()
|
|
301
|
+
except EOFError:
|
|
302
|
+
value = ""
|
|
303
|
+
except KeyboardInterrupt:
|
|
304
|
+
ErrorHandler.display_warning("Cancelled by user")
|
|
305
|
+
raise typer.Exit(code=0)
|
|
306
|
+
|
|
307
|
+
if not value:
|
|
308
|
+
console.print(f"[{COLOR.ERROR}]{empty_message}[/{COLOR.ERROR}]")
|
|
309
|
+
|
|
310
|
+
return value
|
|
311
|
+
|
|
312
|
+
|
|
286
313
|
def run_interactive(
|
|
287
314
|
app: typer.Typer,
|
|
288
315
|
cmd_parts: list[str] | None = None,
|
|
@@ -457,28 +484,13 @@ def run_interactive(
|
|
|
457
484
|
)
|
|
458
485
|
value = str(int_value)
|
|
459
486
|
else:
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
prompt_text
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
prompt_text
|
|
466
|
-
|
|
467
|
-
console.print(f"[bold {COLOR.SECONDARY}]└─> ", end="")
|
|
468
|
-
|
|
469
|
-
try:
|
|
470
|
-
user_input = input()
|
|
471
|
-
value = user_input.strip()
|
|
472
|
-
except EOFError:
|
|
473
|
-
value = ""
|
|
474
|
-
except KeyboardInterrupt:
|
|
475
|
-
ErrorHandler.display_warning("Cancelled by user")
|
|
476
|
-
raise typer.Exit(code=0)
|
|
477
|
-
|
|
478
|
-
if not value:
|
|
479
|
-
console.print(
|
|
480
|
-
f"[{COLOR.ERROR}]Value is required. Please enter a value.[/{COLOR.ERROR}]"
|
|
481
|
-
)
|
|
487
|
+
prompt_text = f"Enter value for '{arg_name}'"
|
|
488
|
+
if arg_help:
|
|
489
|
+
prompt_text += f" ({arg_help})"
|
|
490
|
+
prompt_text += ":"
|
|
491
|
+
value = _prompt_for_text(
|
|
492
|
+
prompt_text, "Value is required. Please enter a value."
|
|
493
|
+
)
|
|
482
494
|
|
|
483
495
|
if " " in value:
|
|
484
496
|
value = f'"{value}"'
|
|
@@ -555,23 +567,14 @@ def run_interactive(
|
|
|
555
567
|
)
|
|
556
568
|
option_values.append(f"{first_flag} {int_value}")
|
|
557
569
|
else:
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
prompt_text
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
prompt_text
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
try:
|
|
567
|
-
opt_value = input().strip()
|
|
568
|
-
except KeyboardInterrupt:
|
|
569
|
-
ErrorHandler.display_warning("Cancelled by user")
|
|
570
|
-
raise typer.Exit(code=0)
|
|
571
|
-
if not opt_value:
|
|
572
|
-
console.print(
|
|
573
|
-
f"[{COLOR.ERROR}]Value is required. Please enter a value or press Ctrl+C to cancel.[/{COLOR.ERROR}]"
|
|
574
|
-
)
|
|
570
|
+
prompt_text = f"Value for {first_flag}"
|
|
571
|
+
if help_text:
|
|
572
|
+
prompt_text += f" ({help_text})"
|
|
573
|
+
prompt_text += ":"
|
|
574
|
+
opt_value = _prompt_for_text(
|
|
575
|
+
prompt_text,
|
|
576
|
+
"Value is required. Please enter a value or press Ctrl+C to cancel.",
|
|
577
|
+
)
|
|
575
578
|
if " " in opt_value:
|
|
576
579
|
opt_value = f'"{opt_value}"'
|
|
577
580
|
option_values.append(f"{first_flag} {opt_value}")
|
|
@@ -3,10 +3,15 @@
|
|
|
3
3
|
Typer >= 0.28 replaced ``TyperOption``'s ``type`` argument with a required
|
|
4
4
|
``type_descriptor``. usecli builds options directly to inject framework-wide
|
|
5
5
|
flags, so it must support both layouts.
|
|
6
|
+
|
|
7
|
+
Typer also vendors its own click, whose parameter classes predate click's
|
|
8
|
+
``get_error_hint(ctx)`` signature. usecli formats typer parameters with
|
|
9
|
+
click's exception classes, so the hint methods are adapted below.
|
|
6
10
|
"""
|
|
7
11
|
|
|
8
12
|
from __future__ import annotations
|
|
9
13
|
|
|
14
|
+
import functools
|
|
10
15
|
import inspect
|
|
11
16
|
from typing import Any
|
|
12
17
|
|
|
@@ -17,6 +22,22 @@ _HAS_TYPE_DESCRIPTOR = (
|
|
|
17
22
|
)
|
|
18
23
|
|
|
19
24
|
|
|
25
|
+
def _accept_click_ctx(method: Any) -> Any:
|
|
26
|
+
"""Let click pass its context to a typer parameter's error hint method."""
|
|
27
|
+
if "ctx" in inspect.signature(method).parameters:
|
|
28
|
+
return method
|
|
29
|
+
|
|
30
|
+
@functools.wraps(method)
|
|
31
|
+
def get_error_hint(self: Any, ctx: Any = None) -> str:
|
|
32
|
+
return method(self)
|
|
33
|
+
|
|
34
|
+
return get_error_hint
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
TyperArgument.get_error_hint = _accept_click_ctx(TyperArgument.get_error_hint)
|
|
38
|
+
TyperOption.get_error_hint = _accept_click_ctx(TyperOption.get_error_hint)
|
|
39
|
+
|
|
40
|
+
|
|
20
41
|
def _type_descriptor(annotation: type, *, argument: bool = False) -> Any:
|
|
21
42
|
from typer._coercion import resolve_type_descriptor
|
|
22
43
|
from typer.models import ArgumentInfo, OptionInfo
|
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import sys
|
|
6
|
+
from collections.abc import Sequence
|
|
6
7
|
from typing import IO
|
|
7
8
|
|
|
8
9
|
from click.core import Context as ClickContext
|
|
10
|
+
from click.core import Parameter as ClickParameter
|
|
9
11
|
from click.exceptions import BadParameter, Exit, UsageError
|
|
10
12
|
from rich.console import Console
|
|
11
13
|
|
|
@@ -67,7 +69,8 @@ class UsecliUsageError(UsageError):
|
|
|
67
69
|
if self.ctx:
|
|
68
70
|
console.print()
|
|
69
71
|
help_text = _get_help_text_with_command_name(self.ctx)
|
|
70
|
-
|
|
72
|
+
if help_text:
|
|
73
|
+
console.print(help_text)
|
|
71
74
|
|
|
72
75
|
|
|
73
76
|
class UsecliBadParameter(BadParameter):
|
|
@@ -77,6 +80,30 @@ class UsecliBadParameter(BadParameter):
|
|
|
77
80
|
Provides highlighted error boxes and command help on validation failures.
|
|
78
81
|
"""
|
|
79
82
|
|
|
83
|
+
def __init__(
|
|
84
|
+
self,
|
|
85
|
+
message: str,
|
|
86
|
+
ctx: ClickContext | None = None,
|
|
87
|
+
param: ClickParameter | None = None,
|
|
88
|
+
param_hint: str | Sequence[str] | None = None,
|
|
89
|
+
formatted_message: str | None = None,
|
|
90
|
+
) -> None:
|
|
91
|
+
"""Initialize the styled parameter error.
|
|
92
|
+
|
|
93
|
+
Args:
|
|
94
|
+
message: Raw error reason (Click's ``BadParameter.message``).
|
|
95
|
+
ctx: Click context used to render command help.
|
|
96
|
+
param: Parameter the error refers to.
|
|
97
|
+
param_hint: Explicit hint replacing the parameter-derived hint.
|
|
98
|
+
formatted_message: Fully formatted message to render instead of
|
|
99
|
+
rebuilding one from ``message``. Wrappers use this to keep
|
|
100
|
+
the original exception's wording (for example Click's
|
|
101
|
+
``MissingParameter``, whose reason lives only in
|
|
102
|
+
``format_message``).
|
|
103
|
+
"""
|
|
104
|
+
super().__init__(message, ctx=ctx, param=param, param_hint=param_hint)
|
|
105
|
+
self.formatted_message = formatted_message
|
|
106
|
+
|
|
80
107
|
def show(self, file: IO[str] | None = None) -> None:
|
|
81
108
|
"""Display styled parameter error with command help.
|
|
82
109
|
|
|
@@ -88,12 +115,14 @@ class UsecliBadParameter(BadParameter):
|
|
|
88
115
|
|
|
89
116
|
console.print()
|
|
90
117
|
|
|
118
|
+
message = self.formatted_message or self.format_message()
|
|
91
119
|
error_prefix = (
|
|
92
120
|
f"[bold black on {COLOR.ERROR}] ERROR [/bold black on {COLOR.ERROR}]"
|
|
93
121
|
)
|
|
94
|
-
error_msg = f"[bold {COLOR.ERROR}]{
|
|
122
|
+
error_msg = f"[bold {COLOR.ERROR}]{message}[/bold {COLOR.ERROR}]"
|
|
95
123
|
console.print(f"{error_prefix} {error_msg}")
|
|
96
124
|
|
|
97
125
|
if self.ctx:
|
|
98
126
|
help_text = _get_help_text_with_command_name(self.ctx)
|
|
99
|
-
|
|
127
|
+
if help_text:
|
|
128
|
+
console.print(help_text)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|