usecli 0.1.64__tar.gz → 0.1.66__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.64 → usecli-0.1.66}/PKG-INFO +1 -1
- {usecli-0.1.64 → usecli-0.1.66}/pyproject.toml +1 -1
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/__init__.py +5 -1
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/commands/defaults/make/make_theme_command.py +2 -48
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/shared/config/manager.py +19 -0
- {usecli-0.1.64 → usecli-0.1.66}/LICENSE +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/README.md +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/__init__.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/commands/README.md +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/commands/__init__.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/commands/custom/README.md +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/commands/custom/__init__.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/commands/defaults/__init__.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/commands/defaults/base/__init__.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/commands/defaults/base/about_command.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/commands/defaults/base/help_command.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/commands/defaults/base/inspire_command.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/commands/defaults/base/internal/__init__.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/commands/defaults/base/internal/fzf_command.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/commands/defaults/core/__init__.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/commands/defaults/core/utils.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/commands/defaults/make/__init__.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/commands/defaults/make/make_command.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/commands/init_command.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/config/__init__.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/config/colors.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/core/__init__.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/core/base_command.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/core/error/__init__.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/core/error/handler.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/core/error/utils.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/core/exceptions/__init__.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/core/exceptions/base.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/core/exceptions/config.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/core/exceptions/usage.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/core/exceptions/validation.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/core/ui/__init__.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/core/ui/list.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/core/ui/title.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/core/ui/title.txt +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/core/validators/__init__.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/core/validators/network.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/core/validators/numeric.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/core/validators/path.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/core/validators/string.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/services/__init__.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/services/command_service.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/templates/command.py.j2 +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/templates/theme.toml.j2 +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/templates/usecli.config.toml.j2 +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/themes/ayu_dark.toml +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/themes/catppuccin_frappe.toml +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/themes/catppuccin_latte.toml +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/themes/catppuccin_macchiato.toml +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/themes/catppuccin_mocha.toml +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/themes/default.toml +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/themes/dracula.toml +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/themes/gruvbox_dark.toml +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/themes/nord.toml +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/themes/tokyo_night.toml +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/utils/__init__.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/utils/interactive/__init__.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/cli/utils/interactive/terminal_menu.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/menu.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/params.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/shared/__init__.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/shared/config/__init__.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/shared/config/globals.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/ui.py +0 -0
- {usecli-0.1.64 → usecli-0.1.66}/src/usecli/usecli.config.toml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "usecli"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.66"
|
|
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" }]
|
|
@@ -15,6 +15,8 @@ if TYPE_CHECKING:
|
|
|
15
15
|
import typer
|
|
16
16
|
from rich.console import Console
|
|
17
17
|
|
|
18
|
+
from usecli.cli.config.colors import COLOR
|
|
19
|
+
from usecli.cli.config.colors import COLOR as theme
|
|
18
20
|
from usecli.cli.core.base_command import BaseCommand
|
|
19
21
|
from usecli.menu import Menu
|
|
20
22
|
from usecli.params import Argument, Option
|
|
@@ -48,7 +50,7 @@ def __getattr__(name: str) -> Any:
|
|
|
48
50
|
return value
|
|
49
51
|
|
|
50
52
|
# Handle CLI framework components - lazy initialization
|
|
51
|
-
if name in ("app", "service", "BaseCommand", "colors", "theme"):
|
|
53
|
+
if name in ("app", "service", "BaseCommand", "colors", "COLOR", "theme"):
|
|
52
54
|
_ensure_cli_initialized()
|
|
53
55
|
return globals()[name]
|
|
54
56
|
|
|
@@ -191,6 +193,7 @@ def _ensure_cli_initialized() -> None:
|
|
|
191
193
|
# Setup module aliasing
|
|
192
194
|
colors = import_module("usecli.cli.config.colors")
|
|
193
195
|
globals()["colors"] = colors
|
|
196
|
+
globals()["COLOR"] = COLOR
|
|
194
197
|
globals()["theme"] = COLOR
|
|
195
198
|
sys.modules.setdefault(__name__ + ".colors", colors)
|
|
196
199
|
sys.modules.setdefault("colors", colors)
|
|
@@ -229,6 +232,7 @@ def _get_service():
|
|
|
229
232
|
|
|
230
233
|
__all__ = [
|
|
231
234
|
"BaseCommand",
|
|
235
|
+
"COLOR",
|
|
232
236
|
"console",
|
|
233
237
|
"Console",
|
|
234
238
|
"main",
|
|
@@ -13,12 +13,7 @@ from rich.console import Console
|
|
|
13
13
|
from usecli.cli.config.colors import COLOR
|
|
14
14
|
from usecli.cli.core.base_command import BaseCommand
|
|
15
15
|
from usecli.shared.config.globals import TEMPLATES_DIR
|
|
16
|
-
from usecli.shared.config.manager import
|
|
17
|
-
ConfigManager,
|
|
18
|
-
find_project_root,
|
|
19
|
-
get_config,
|
|
20
|
-
reset_config,
|
|
21
|
-
)
|
|
16
|
+
from usecli.shared.config.manager import find_project_root, get_config, reset_config
|
|
22
17
|
|
|
23
18
|
console = Console()
|
|
24
19
|
|
|
@@ -49,25 +44,7 @@ class MakeThemeCommand(BaseCommand):
|
|
|
49
44
|
config = get_config()
|
|
50
45
|
|
|
51
46
|
project_paths = config.get_project_paths()
|
|
52
|
-
|
|
53
|
-
if not themes_entries:
|
|
54
|
-
console.print(
|
|
55
|
-
f"[{COLOR.ERROR}]Error: No theme directory configured.[/{COLOR.ERROR}]"
|
|
56
|
-
)
|
|
57
|
-
return
|
|
58
|
-
|
|
59
|
-
default_entries = self._normalize_theme_entries(
|
|
60
|
-
ConfigManager.DEFAULT_CONFIG.get("themes_dir", [])
|
|
61
|
-
)
|
|
62
|
-
preferred_entries = [
|
|
63
|
-
entry for entry in themes_entries if entry not in default_entries
|
|
64
|
-
]
|
|
65
|
-
if not preferred_entries:
|
|
66
|
-
preferred_entries = themes_entries
|
|
67
|
-
|
|
68
|
-
themes_dir = self._resolve_theme_dir(
|
|
69
|
-
preferred_entries[0], config.get_project_root()
|
|
70
|
-
)
|
|
47
|
+
themes_dir = project_paths["themes_dir"]
|
|
71
48
|
themes_dir.mkdir(parents=True, exist_ok=True)
|
|
72
49
|
|
|
73
50
|
base_name = Path(clean_name).name
|
|
@@ -103,26 +80,3 @@ class MakeThemeCommand(BaseCommand):
|
|
|
103
80
|
console.print(
|
|
104
81
|
f"[{COLOR.SUCCESS}]Successfully created theme at {target_file}[/{COLOR.SUCCESS}]"
|
|
105
82
|
)
|
|
106
|
-
|
|
107
|
-
@staticmethod
|
|
108
|
-
def _normalize_theme_entries(value: object) -> list[str]:
|
|
109
|
-
if isinstance(value, str):
|
|
110
|
-
normalized = value.strip()
|
|
111
|
-
return [normalized] if normalized else []
|
|
112
|
-
if isinstance(value, list):
|
|
113
|
-
result: list[str] = []
|
|
114
|
-
for entry in value:
|
|
115
|
-
if not isinstance(entry, str):
|
|
116
|
-
continue
|
|
117
|
-
normalized = entry.strip()
|
|
118
|
-
if normalized:
|
|
119
|
-
result.append(normalized)
|
|
120
|
-
return result
|
|
121
|
-
return []
|
|
122
|
-
|
|
123
|
-
@staticmethod
|
|
124
|
-
def _resolve_theme_dir(entry: str, project_root: Path) -> Path:
|
|
125
|
-
theme_path = Path(entry)
|
|
126
|
-
if not theme_path.is_absolute():
|
|
127
|
-
theme_path = project_root / theme_path
|
|
128
|
-
return theme_path.resolve()
|
|
@@ -856,9 +856,13 @@ class ConfigManager:
|
|
|
856
856
|
def get_project_paths(self) -> dict[str, Path]:
|
|
857
857
|
project_config = self._find_project_config()
|
|
858
858
|
if project_config is None:
|
|
859
|
+
themes_dirs = self.get_project_themes_dirs()
|
|
859
860
|
return {
|
|
860
861
|
"commands_dir": self.get_project_commands_dir(),
|
|
861
862
|
"templates_dir": self.get_project_templates_dir(),
|
|
863
|
+
"themes_dir": themes_dirs[0]
|
|
864
|
+
if themes_dirs
|
|
865
|
+
else self.get_project_root() / "cli" / "themes",
|
|
862
866
|
}
|
|
863
867
|
config_dir = project_config.parent
|
|
864
868
|
config_data = self._load_usecli_toml(project_config)
|
|
@@ -870,9 +874,24 @@ class ConfigManager:
|
|
|
870
874
|
commands_path = config_dir / commands_path
|
|
871
875
|
if not templates_path.is_absolute():
|
|
872
876
|
templates_path = config_dir / templates_path
|
|
877
|
+
|
|
878
|
+
themes_entries = _normalize_themes_dir(config_data.get("themes_dir", []))
|
|
879
|
+
if not themes_entries:
|
|
880
|
+
themes_entries = _normalize_themes_dir(
|
|
881
|
+
self.DEFAULT_CONFIG.get("themes_dir", [])
|
|
882
|
+
)
|
|
883
|
+
themes_path = (
|
|
884
|
+
_get_path()(themes_entries[0])
|
|
885
|
+
if themes_entries
|
|
886
|
+
else _get_path()("cli/themes")
|
|
887
|
+
)
|
|
888
|
+
if not themes_path.is_absolute():
|
|
889
|
+
themes_path = config_dir / themes_path
|
|
890
|
+
|
|
873
891
|
return {
|
|
874
892
|
"commands_dir": commands_path.resolve(),
|
|
875
893
|
"templates_dir": templates_path.resolve(),
|
|
894
|
+
"themes_dir": themes_path.resolve(),
|
|
876
895
|
}
|
|
877
896
|
|
|
878
897
|
def _find_project_config(self) -> Path | None:
|
|
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
|
{usecli-0.1.64 → usecli-0.1.66}/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
|
|
File without changes
|