usecli 0.1.50__tar.gz → 0.1.52__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.
Files changed (72) hide show
  1. {usecli-0.1.50 → usecli-0.1.52}/PKG-INFO +1 -1
  2. {usecli-0.1.50 → usecli-0.1.52}/pyproject.toml +1 -1
  3. usecli-0.1.52/src/usecli/cli/commands/defaults/base/inspire_command.py +88 -0
  4. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/commands/defaults/base/internal/fzf_command.py +5 -3
  5. usecli-0.1.52/src/usecli/cli/core/ui/__init__.py +31 -0
  6. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/core/ui/list.py +3 -3
  7. usecli-0.1.50/src/usecli/cli/commands/defaults/base/inspire_command.py +0 -57
  8. usecli-0.1.50/src/usecli/cli/core/ui/__init__.py +0 -16
  9. {usecli-0.1.50 → usecli-0.1.52}/LICENSE +0 -0
  10. {usecli-0.1.50 → usecli-0.1.52}/README.md +0 -0
  11. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/__init__.py +0 -0
  12. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/__init__.py +0 -0
  13. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/commands/README.md +0 -0
  14. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/commands/__init__.py +0 -0
  15. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/commands/custom/README.md +0 -0
  16. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/commands/custom/__init__.py +0 -0
  17. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/commands/defaults/__init__.py +0 -0
  18. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/commands/defaults/base/__init__.py +0 -0
  19. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/commands/defaults/base/about_command.py +0 -0
  20. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/commands/defaults/base/help_command.py +0 -0
  21. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/commands/defaults/base/internal/__init__.py +0 -0
  22. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/commands/defaults/core/__init__.py +0 -0
  23. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/commands/defaults/core/utils.py +0 -0
  24. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/commands/defaults/make/__init__.py +0 -0
  25. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/commands/defaults/make/make_command.py +0 -0
  26. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/commands/defaults/make/make_theme_command.py +0 -0
  27. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/commands/init_command.py +0 -0
  28. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/config/__init__.py +0 -0
  29. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/config/colors.py +0 -0
  30. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/core/__init__.py +0 -0
  31. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/core/base_command.py +0 -0
  32. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/core/error/__init__.py +0 -0
  33. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/core/error/handler.py +0 -0
  34. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/core/error/utils.py +0 -0
  35. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/core/exceptions/__init__.py +0 -0
  36. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/core/exceptions/base.py +0 -0
  37. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/core/exceptions/config.py +0 -0
  38. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/core/exceptions/usage.py +0 -0
  39. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/core/exceptions/validation.py +0 -0
  40. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/core/ui/title.py +0 -0
  41. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/core/ui/title.txt +0 -0
  42. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/core/validators/__init__.py +0 -0
  43. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/core/validators/network.py +0 -0
  44. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/core/validators/numeric.py +0 -0
  45. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/core/validators/path.py +0 -0
  46. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/core/validators/string.py +0 -0
  47. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/services/__init__.py +0 -0
  48. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/services/command_service.py +0 -0
  49. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/templates/command.py.j2 +0 -0
  50. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/templates/theme.toml.j2 +0 -0
  51. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/templates/usecli.config.toml.j2 +0 -0
  52. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/themes/ayu_dark.toml +0 -0
  53. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/themes/catppuccin_frappe.toml +0 -0
  54. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/themes/catppuccin_latte.toml +0 -0
  55. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/themes/catppuccin_macchiato.toml +0 -0
  56. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/themes/catppuccin_mocha.toml +0 -0
  57. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/themes/default.toml +0 -0
  58. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/themes/dracula.toml +0 -0
  59. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/themes/gruvbox_dark.toml +0 -0
  60. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/themes/nord.toml +0 -0
  61. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/themes/tokyo_night.toml +0 -0
  62. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/utils/__init__.py +0 -0
  63. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/utils/interactive/__init__.py +0 -0
  64. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/cli/utils/interactive/terminal_menu.py +0 -0
  65. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/menu.py +0 -0
  66. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/params.py +0 -0
  67. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/shared/__init__.py +0 -0
  68. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/shared/config/__init__.py +0 -0
  69. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/shared/config/globals.py +0 -0
  70. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/shared/config/manager.py +0 -0
  71. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/ui.py +0 -0
  72. {usecli-0.1.50 → usecli-0.1.52}/src/usecli/usecli.config.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: usecli
3
- Version: 0.1.50
3
+ Version: 0.1.52
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>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "usecli"
3
- version = "0.1.50"
3
+ version = "0.1.52"
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" }]
@@ -0,0 +1,88 @@
1
+ """Inspire command for displaying random inspirational quotes."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import random
6
+
7
+ from rich.console import Console
8
+ from rich.panel import Panel
9
+
10
+ from usecli.cli.config.colors import COLOR
11
+ from usecli.cli.core.base_command import BaseCommand
12
+ from usecli.shared.config.manager import get_config
13
+
14
+ console = Console()
15
+
16
+
17
+ class InspireCommand(BaseCommand):
18
+ """Command for displaying random inspirational quotes."""
19
+
20
+ def visible(self) -> bool:
21
+ config = get_config()
22
+ return not config.get("hide_inspire", False)
23
+
24
+ def signature(self) -> str:
25
+ """Return the command signature."""
26
+ return "inspire"
27
+
28
+ def description(self) -> str:
29
+ """Return the command description."""
30
+ return "Show a random inspirational quote"
31
+
32
+ def handle(self) -> None:
33
+ """Handle the command execution."""
34
+
35
+ quotes = [
36
+ "Act only according to that maxim whereby you can, at the same time, will that it should become a universal law. - Immanuel Kant",
37
+ "An unexamined life is not worth living. - Socrates",
38
+ "Be present above all else. - Naval Ravikant",
39
+ "Do what you can, with what you have, where you are. - Theodore Roosevelt",
40
+ "Happiness is not something readymade. It comes from your own actions. - Dalai Lama",
41
+ "He who is contented is rich. - Laozi",
42
+ "I begin to speak only when I am certain what I will say is not better left unsaid. - Cato the Younger",
43
+ "I have not failed. I've just found 10,000 ways that won't work. - Thomas Edison",
44
+ "If you do not have a consistent goal in life, you can not live it in a consistent way. - Marcus Aurelius",
45
+ "It is never too late to be what you might have been. - George Eliot",
46
+ "It is not the man who has too little, but the man who craves more, that is poor. - Seneca",
47
+ "It is quality rather than quantity that matters. - Lucius Annaeus Seneca",
48
+ "Knowing is not enough; we must apply. Being willing is not enough; we must do. - Leonardo da Vinci",
49
+ "Let all your things have their places; let each part of your business have its time. - Benjamin Franklin",
50
+ "Live as if you were to die tomorrow. Learn as if you were to live forever. - Mahatma Gandhi",
51
+ "No surplus words or unnecessary actions. - Marcus Aurelius",
52
+ "Nothing worth having comes easy. - Theodore Roosevelt",
53
+ "Order your soul. Reduce your wants. - Augustine",
54
+ "People find pleasure in different ways. I find it in keeping my mind clear. - Marcus Aurelius",
55
+ "Simplicity is an acquired taste. - Katharine Gerould",
56
+ "Simplicity is the consequence of refined emotions. - Jean D'Alembert",
57
+ "Simplicity is the essence of happiness. - Cedric Bledsoe",
58
+ "Simplicity is the ultimate sophistication. - Leonardo da Vinci",
59
+ "Smile, breathe, and go slowly. - Thich Nhat Hanh",
60
+ "The only way to do great work is to love what you do. - Steve Jobs",
61
+ "The whole future lies in uncertainty: live immediately. - Seneca",
62
+ "Very little is needed to make a happy life. - Marcus Aurelius",
63
+ "Waste no more time arguing what a good man should be, be one. - Marcus Aurelius",
64
+ "Well begun is half done. - Aristotle",
65
+ "When there is no desire, all things are at peace. - Laozi",
66
+ "Walk as if you are kissing the Earth with your feet. - Thich Nhat Hanh",
67
+ "Because you are alive, everything is possible. - Thich Nhat Hanh",
68
+ "Breathing in, I calm body and mind. Breathing out, I smile. - Thich Nhat Hanh",
69
+ "Life is available only in the present moment. - Thich Nhat Hanh",
70
+ "The best way to take care of the future is to take care of the present moment. - Thich Nhat Hanh",
71
+ "Nothing in life is to be feared, it is only to be understood. Now is the time to understand more, so that we may fear less. - Maria Skłodowska-Curie",
72
+ "The biggest battle is the war against ignorance. - Mustafa Kemal Atatürk",
73
+ "Always remember that you are absolutely unique. Just like everyone else. - Margaret Mead",
74
+ "You must be the change you wish to see in the world. - Mahatma Gandhi",
75
+ "It always seems impossible until it is done. - Nelson Mandela",
76
+ ]
77
+
78
+ selected = random.choice(quotes)
79
+ quote, author = selected.rsplit(" - ", 1)
80
+
81
+ console.print(
82
+ Panel(
83
+ f"{quote}\n\n[{COLOR.FOREGROUND_MUTED}]— {author}[/{COLOR.FOREGROUND_MUTED}]",
84
+ border_style=COLOR.PANEL_PRIMARY,
85
+ title="Inspire",
86
+ title_align="left",
87
+ )
88
+ )
@@ -19,6 +19,7 @@ from usecli.cli.config.colors import COLOR
19
19
  from usecli.cli.core.base_command import BaseCommand
20
20
  from usecli.cli.core.error.handler import ErrorHandler
21
21
  from usecli.cli.core.exceptions import UsecliError
22
+ from usecli.cli.core.ui import is_click_group
22
23
  from usecli.cli.utils.interactive.terminal_menu import terminal_menu
23
24
 
24
25
  if TYPE_CHECKING:
@@ -208,9 +209,10 @@ def run_interactive(
208
209
 
209
210
  click_group = typer.main.get_command(app)
210
211
  groups: dict[str, str] = {}
211
- if isinstance(click_group, click.Group):
212
- for cmd_name, cmd_obj in click_group.commands.items():
213
- if isinstance(cmd_obj, click.Group):
212
+ if is_click_group(click_group):
213
+ sub_commands: dict[str, object] = getattr(click_group, "commands", {})
214
+ for cmd_name, cmd_obj in sub_commands.items():
215
+ if is_click_group(cmd_obj):
214
216
  groups[cmd_name] = (
215
217
  getattr(cmd_obj, "help", f"Commands for {cmd_name}")
216
218
  or f"Commands for {cmd_name}"
@@ -0,0 +1,31 @@
1
+ """UI helpers for usecli CLI."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import click
6
+
7
+ from usecli.cli.config.colors import COLOR, bold, style
8
+ from usecli.cli.core.ui.list import list_commands
9
+ from usecli.cli.core.ui.title import get_project_name, print_title
10
+
11
+
12
+ def is_click_group(obj: object) -> bool:
13
+ """Check if an object is a Click group (has subcommands).
14
+
15
+ Works with both standard click.Group and Typer's vendored click
16
+ (TyperGroup in typer>=0.26 no longer extends click.Group directly).
17
+ """
18
+ return isinstance(obj, click.Group) or (
19
+ hasattr(obj, "commands") and isinstance(getattr(obj, "commands", None), dict)
20
+ )
21
+
22
+
23
+ __all__ = [
24
+ "COLOR",
25
+ "bold",
26
+ "is_click_group",
27
+ "list_commands",
28
+ "print_title",
29
+ "get_project_name",
30
+ "style",
31
+ ]
@@ -29,9 +29,9 @@ def _is_click_group(obj: object) -> bool:
29
29
  Works with both standard click.Group and Typer's vendored click
30
30
  (TyperGroup in typer>=0.26 no longer extends click.Group directly).
31
31
  """
32
- return isinstance(obj, click.Group) or (
33
- hasattr(obj, "commands") and isinstance(getattr(obj, "commands", None), dict)
34
- )
32
+ from usecli.cli.core.ui import is_click_group
33
+
34
+ return is_click_group(obj)
35
35
 
36
36
 
37
37
  class CommandEntry(TypedDict):
@@ -1,57 +0,0 @@
1
- """Inspire command for displaying random inspirational quotes."""
2
-
3
- from __future__ import annotations
4
-
5
- import json
6
- import urllib.request
7
-
8
- from rich.console import Console
9
- from rich.panel import Panel
10
-
11
- from usecli.cli.config.colors import COLOR
12
- from usecli.cli.core.base_command import BaseCommand
13
- from usecli.shared.config.manager import get_config
14
-
15
- console = Console()
16
-
17
-
18
- class InspireCommand(BaseCommand):
19
- """Command for displaying random inspirational quotes."""
20
-
21
- def visible(self) -> bool:
22
- config = get_config()
23
- return not config.get("hide_inspire", False)
24
-
25
- def signature(self) -> str:
26
- """Return the command signature."""
27
- return "inspire"
28
-
29
- def description(self) -> str:
30
- """Return the command description."""
31
- return "Show a random inspirational quote"
32
-
33
- def handle(self) -> None:
34
- """Handle the command execution."""
35
- try:
36
- req = urllib.request.Request(
37
- "https://zenquotes.io/api/random/inspiration",
38
- headers={
39
- "User-Agent": "Mozilla/5.0 (compatible; usecli/1.0)",
40
- "Accept": "application/json",
41
- },
42
- )
43
- with urllib.request.urlopen(req, timeout=10) as response:
44
- data: list[dict[str, str]] = json.loads(response.read().decode())
45
- quote = data[0]["q"]
46
- author = data[0]["a"]
47
-
48
- console.print(
49
- Panel(
50
- f"{quote}\n\n[{COLOR.FOREGROUND_MUTED}]— {author}[/{COLOR.FOREGROUND_MUTED}]",
51
- border_style=COLOR.PANEL_PRIMARY,
52
- title="Inspire",
53
- title_align="left",
54
- )
55
- )
56
- except Exception as e:
57
- console.print(f"[{COLOR.ERROR}]Error fetching quote: {e}[/{COLOR.ERROR}]")
@@ -1,16 +0,0 @@
1
- """UI helpers for usecli CLI."""
2
-
3
- from __future__ import annotations
4
-
5
- from usecli.cli.config.colors import COLOR, bold, style
6
- from usecli.cli.core.ui.list import list_commands
7
- from usecli.cli.core.ui.title import get_project_name, print_title
8
-
9
- __all__ = [
10
- "COLOR",
11
- "bold",
12
- "style",
13
- "print_title",
14
- "get_project_name",
15
- "list_commands",
16
- ]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes