usecli 0.1.28__tar.gz → 0.1.30__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.1.28 → usecli-0.1.30}/PKG-INFO +8 -2
- {usecli-0.1.28 → usecli-0.1.30}/README.md +7 -1
- {usecli-0.1.28 → usecli-0.1.30}/pyproject.toml +1 -1
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/__init__.py +40 -1
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/core/base_command.py +3 -1
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/core/exceptions/usage.py +17 -2
- {usecli-0.1.28 → usecli-0.1.30}/LICENSE +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/__init__.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/commands/README.md +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/commands/__init__.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/commands/custom/README.md +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/commands/custom/__init__.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/commands/defaults/__init__.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/commands/defaults/base/__init__.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/commands/defaults/base/about_command.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/commands/defaults/base/help_command.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/commands/defaults/base/inspire_command.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/commands/defaults/base/internal/__init__.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/commands/defaults/base/internal/fzf_command.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/commands/defaults/core/__init__.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/commands/defaults/core/utils.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/commands/defaults/make/__init__.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/commands/defaults/make/make_command.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/commands/defaults/make/make_theme_command.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/commands/init_command.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/config/__init__.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/config/colors.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/core/__init__.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/core/error/__init__.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/core/error/handler.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/core/error/utils.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/core/exceptions/__init__.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/core/exceptions/base.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/core/exceptions/config.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/core/exceptions/validation.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/core/skill_generator.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/core/ui/__init__.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/core/ui/list.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/core/ui/title.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/core/validators/__init__.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/core/validators/network.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/core/validators/numeric.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/core/validators/path.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/core/validators/string.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/services/__init__.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/services/command_service.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/templates/command.py.j2 +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/templates/theme.toml.j2 +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/templates/usecli.toml.j2 +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/themes/ayu_dark.toml +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/themes/catppuccin_frappe.toml +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/themes/catppuccin_latte.toml +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/themes/catppuccin_macchiato.toml +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/themes/catppuccin_mocha.toml +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/themes/default.toml +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/themes/dracula.toml +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/themes/gruvbox_dark.toml +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/themes/nord.toml +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/themes/tokyo_night.toml +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/utils/__init__.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/utils/interactive/__init__.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/utils/interactive/terminal_menu.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/menu.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/params.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/shared/__init__.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/shared/config/__init__.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/shared/config/globals.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/shared/config/manager.py +0 -0
- {usecli-0.1.28 → usecli-0.1.30}/src/usecli/ui.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: usecli
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.30
|
|
4
4
|
Summary: A powerful Python CLI framework for building beautiful, developer-friendly command-line tools.
|
|
5
5
|
Author: Edward Boswell
|
|
6
6
|
Author-email: Edward Boswell <thememium@gmail.com>
|
|
@@ -77,12 +77,18 @@ useCli A powerful Python CLI framework for building beautiful, developer-friendl
|
|
|
77
77
|
|
|
78
78
|
## Quick Start
|
|
79
79
|
|
|
80
|
-
### Install usecli
|
|
80
|
+
### Install usecli with uv (recommended)
|
|
81
81
|
|
|
82
82
|
```sh
|
|
83
83
|
uv add usecli
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
+
### Install with pip (alternative)
|
|
87
|
+
|
|
88
|
+
```sh
|
|
89
|
+
pip install usecli
|
|
90
|
+
```
|
|
91
|
+
|
|
86
92
|
### Initialize
|
|
87
93
|
|
|
88
94
|
```sh
|
|
@@ -48,12 +48,18 @@ useCli A powerful Python CLI framework for building beautiful, developer-friendl
|
|
|
48
48
|
|
|
49
49
|
## Quick Start
|
|
50
50
|
|
|
51
|
-
### Install usecli
|
|
51
|
+
### Install usecli with uv (recommended)
|
|
52
52
|
|
|
53
53
|
```sh
|
|
54
54
|
uv add usecli
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
+
### Install with pip (alternative)
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
pip install usecli
|
|
61
|
+
```
|
|
62
|
+
|
|
57
63
|
### Initialize
|
|
58
64
|
|
|
59
65
|
```sh
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "usecli"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.30"
|
|
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" }]
|
|
@@ -17,6 +17,7 @@ from usecli.cli.core.ui.list import list_commands
|
|
|
17
17
|
from usecli.cli.services.command_service import CommandService
|
|
18
18
|
from usecli.menu import Menu
|
|
19
19
|
from usecli.params import Argument, Option
|
|
20
|
+
from usecli.shared.config.manager import get_config
|
|
20
21
|
from usecli.ui import Confirm, Console, Prompt, console
|
|
21
22
|
|
|
22
23
|
colors = import_module("usecli.cli.config.colors")
|
|
@@ -52,6 +53,44 @@ def _is_interactive_flag_present() -> bool:
|
|
|
52
53
|
return "-i" in sys.argv or "--interactive" in sys.argv
|
|
53
54
|
|
|
54
55
|
|
|
56
|
+
def _get_cli_help_text() -> str:
|
|
57
|
+
fallback = "Usecli CLI - An elegant CLI framework for Python"
|
|
58
|
+
fallback_description = "An elegant CLI framework for Python"
|
|
59
|
+
config = get_config()
|
|
60
|
+
|
|
61
|
+
description = config.get("description")
|
|
62
|
+
has_description = (
|
|
63
|
+
config.has_key("description")
|
|
64
|
+
and isinstance(description, str)
|
|
65
|
+
and description.strip()
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
title = config.get("title")
|
|
69
|
+
has_title = config.has_key("title") and isinstance(title, str) and title.strip()
|
|
70
|
+
|
|
71
|
+
command_name = config.get("command_name")
|
|
72
|
+
has_command_name = (
|
|
73
|
+
config.has_key("command_name")
|
|
74
|
+
and isinstance(command_name, str)
|
|
75
|
+
and command_name.strip()
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
if not has_description and not has_title and not has_command_name:
|
|
79
|
+
return fallback
|
|
80
|
+
|
|
81
|
+
display_name = (
|
|
82
|
+
title.strip()
|
|
83
|
+
if has_title
|
|
84
|
+
else command_name.strip()
|
|
85
|
+
if has_command_name
|
|
86
|
+
else "Usecli CLI"
|
|
87
|
+
)
|
|
88
|
+
display_description = (
|
|
89
|
+
description.strip() if has_description else fallback_description
|
|
90
|
+
)
|
|
91
|
+
return f"{display_name} - {display_description}"
|
|
92
|
+
|
|
93
|
+
|
|
55
94
|
class PrefixMatchingGroup(TyperGroup):
|
|
56
95
|
"""Custom Typer group that supports prefix matching for commands.
|
|
57
96
|
|
|
@@ -134,7 +173,7 @@ class FilteredListCommand(click.Command):
|
|
|
134
173
|
|
|
135
174
|
|
|
136
175
|
app = typer.Typer(
|
|
137
|
-
help=
|
|
176
|
+
help=_get_cli_help_text(),
|
|
138
177
|
invoke_without_command=True,
|
|
139
178
|
no_args_is_help=False,
|
|
140
179
|
cls=PrefixMatchingGroup,
|
|
@@ -12,6 +12,7 @@ from rich.console import Console
|
|
|
12
12
|
from typer.core import TyperCommand
|
|
13
13
|
|
|
14
14
|
from usecli.cli.config.colors import COLOR
|
|
15
|
+
from usecli.cli.core.ui.title import get_script_command_name
|
|
15
16
|
|
|
16
17
|
if TYPE_CHECKING:
|
|
17
18
|
from click.core import Context as ClickContext
|
|
@@ -223,7 +224,8 @@ class CustomHelpCommand(TyperCommand):
|
|
|
223
224
|
]
|
|
224
225
|
|
|
225
226
|
arg_usage = " ".join(rf"\[{name.upper()}]" for name in argument_names)
|
|
226
|
-
|
|
227
|
+
command_name = get_script_command_name(default="usecli") or "usecli"
|
|
228
|
+
usage = f" [bold {COLOR.WARNING}]{command_name} {self.name}[/bold {COLOR.WARNING}] [bold {COLOR.PRIMARY}][OPTIONS]{f' {arg_usage}' if arg_usage else ''}[/bold {COLOR.PRIMARY}]"
|
|
227
229
|
|
|
228
230
|
console.print()
|
|
229
231
|
console.print(f"[bold {COLOR.SECONDARY}]Usage:[/bold {COLOR.SECONDARY}]")
|
|
@@ -5,14 +5,29 @@ from __future__ import annotations
|
|
|
5
5
|
import sys
|
|
6
6
|
from typing import IO
|
|
7
7
|
|
|
8
|
+
from click.core import Context as ClickContext
|
|
8
9
|
from click.exceptions import BadParameter, UsageError
|
|
9
10
|
from rich.console import Console
|
|
10
11
|
|
|
11
12
|
from usecli.cli.config.colors import COLOR
|
|
13
|
+
from usecli.cli.core.ui.title import get_script_command_name
|
|
12
14
|
|
|
13
15
|
console = Console(stderr=True)
|
|
14
16
|
|
|
15
17
|
|
|
18
|
+
def _get_help_text_with_command_name(ctx: ClickContext) -> str:
|
|
19
|
+
command_name = get_script_command_name(default=getattr(ctx, "info_name", None))
|
|
20
|
+
if not command_name:
|
|
21
|
+
return ctx.get_help()
|
|
22
|
+
|
|
23
|
+
original_info_name = getattr(ctx, "info_name", None)
|
|
24
|
+
try:
|
|
25
|
+
ctx.info_name = command_name
|
|
26
|
+
return ctx.get_help()
|
|
27
|
+
finally:
|
|
28
|
+
ctx.info_name = original_info_name
|
|
29
|
+
|
|
30
|
+
|
|
16
31
|
class UsecliUsageError(UsageError):
|
|
17
32
|
"""Usage error with styled output and full command help.
|
|
18
33
|
|
|
@@ -35,7 +50,7 @@ class UsecliUsageError(UsageError):
|
|
|
35
50
|
|
|
36
51
|
if self.ctx:
|
|
37
52
|
console.print()
|
|
38
|
-
help_text = self.ctx
|
|
53
|
+
help_text = _get_help_text_with_command_name(self.ctx)
|
|
39
54
|
console.print(help_text)
|
|
40
55
|
|
|
41
56
|
|
|
@@ -64,5 +79,5 @@ class UsecliBadParameter(BadParameter):
|
|
|
64
79
|
console.print(f"{error_prefix} {error_msg}")
|
|
65
80
|
|
|
66
81
|
if self.ctx:
|
|
67
|
-
help_text = self.ctx
|
|
82
|
+
help_text = _get_help_text_with_command_name(self.ctx)
|
|
68
83
|
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
|
{usecli-0.1.28 → usecli-0.1.30}/src/usecli/cli/commands/defaults/base/internal/fzf_command.py
RENAMED
|
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
|