usecli 0.1.51__tar.gz → 0.1.53__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 (71) hide show
  1. {usecli-0.1.51 → usecli-0.1.53}/PKG-INFO +1 -1
  2. {usecli-0.1.51 → usecli-0.1.53}/pyproject.toml +1 -1
  3. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/__init__.py +5 -1
  4. usecli-0.1.53/src/usecli/cli/commands/defaults/base/inspire_command.py +88 -0
  5. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/core/base_command.py +18 -0
  6. usecli-0.1.51/src/usecli/cli/commands/defaults/base/inspire_command.py +0 -57
  7. {usecli-0.1.51 → usecli-0.1.53}/LICENSE +0 -0
  8. {usecli-0.1.51 → usecli-0.1.53}/README.md +0 -0
  9. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/__init__.py +0 -0
  10. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/commands/README.md +0 -0
  11. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/commands/__init__.py +0 -0
  12. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/commands/custom/README.md +0 -0
  13. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/commands/custom/__init__.py +0 -0
  14. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/commands/defaults/__init__.py +0 -0
  15. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/commands/defaults/base/__init__.py +0 -0
  16. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/commands/defaults/base/about_command.py +0 -0
  17. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/commands/defaults/base/help_command.py +0 -0
  18. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/commands/defaults/base/internal/__init__.py +0 -0
  19. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/commands/defaults/base/internal/fzf_command.py +0 -0
  20. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/commands/defaults/core/__init__.py +0 -0
  21. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/commands/defaults/core/utils.py +0 -0
  22. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/commands/defaults/make/__init__.py +0 -0
  23. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/commands/defaults/make/make_command.py +0 -0
  24. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/commands/defaults/make/make_theme_command.py +0 -0
  25. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/commands/init_command.py +0 -0
  26. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/config/__init__.py +0 -0
  27. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/config/colors.py +0 -0
  28. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/core/__init__.py +0 -0
  29. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/core/error/__init__.py +0 -0
  30. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/core/error/handler.py +0 -0
  31. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/core/error/utils.py +0 -0
  32. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/core/exceptions/__init__.py +0 -0
  33. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/core/exceptions/base.py +0 -0
  34. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/core/exceptions/config.py +0 -0
  35. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/core/exceptions/usage.py +0 -0
  36. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/core/exceptions/validation.py +0 -0
  37. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/core/ui/__init__.py +0 -0
  38. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/core/ui/list.py +0 -0
  39. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/core/ui/title.py +0 -0
  40. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/core/ui/title.txt +0 -0
  41. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/core/validators/__init__.py +0 -0
  42. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/core/validators/network.py +0 -0
  43. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/core/validators/numeric.py +0 -0
  44. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/core/validators/path.py +0 -0
  45. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/core/validators/string.py +0 -0
  46. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/services/__init__.py +0 -0
  47. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/services/command_service.py +0 -0
  48. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/templates/command.py.j2 +0 -0
  49. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/templates/theme.toml.j2 +0 -0
  50. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/templates/usecli.config.toml.j2 +0 -0
  51. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/themes/ayu_dark.toml +0 -0
  52. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/themes/catppuccin_frappe.toml +0 -0
  53. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/themes/catppuccin_latte.toml +0 -0
  54. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/themes/catppuccin_macchiato.toml +0 -0
  55. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/themes/catppuccin_mocha.toml +0 -0
  56. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/themes/default.toml +0 -0
  57. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/themes/dracula.toml +0 -0
  58. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/themes/gruvbox_dark.toml +0 -0
  59. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/themes/nord.toml +0 -0
  60. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/themes/tokyo_night.toml +0 -0
  61. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/utils/__init__.py +0 -0
  62. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/utils/interactive/__init__.py +0 -0
  63. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/cli/utils/interactive/terminal_menu.py +0 -0
  64. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/menu.py +0 -0
  65. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/params.py +0 -0
  66. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/shared/__init__.py +0 -0
  67. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/shared/config/__init__.py +0 -0
  68. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/shared/config/globals.py +0 -0
  69. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/shared/config/manager.py +0 -0
  70. {usecli-0.1.51 → usecli-0.1.53}/src/usecli/ui.py +0 -0
  71. {usecli-0.1.51 → usecli-0.1.53}/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.51
3
+ Version: 0.1.53
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.51"
3
+ version = "0.1.53"
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" }]
@@ -7,7 +7,7 @@ from importlib import import_module
7
7
 
8
8
  import click
9
9
  import typer
10
- from click.exceptions import BadParameter, ClickException, UsageError
10
+ from click.exceptions import BadParameter, ClickException, Exit, UsageError
11
11
  from typer.core import TyperGroup
12
12
 
13
13
  from usecli.cli.config.colors import COLOR
@@ -167,6 +167,8 @@ class PrefixMatchingGroup(TyperGroup):
167
167
  """
168
168
  try:
169
169
  return super().invoke(ctx)
170
+ except Exit:
171
+ sys.exit(0)
170
172
  except BadParameter as e:
171
173
  styled_error = UsecliBadParameter(e.message, ctx=e.ctx, param=e.param)
172
174
  styled_error.show()
@@ -272,6 +274,8 @@ def main() -> None:
272
274
  """Run the CLI application with custom error handling."""
273
275
  try:
274
276
  app()
277
+ except Exit:
278
+ sys.exit(0)
275
279
  except BadParameter as e:
276
280
  styled_error = UsecliBadParameter(e.message, ctx=e.ctx, param=e.param)
277
281
  styled_error.show()
@@ -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
+ )
@@ -268,6 +268,24 @@ class CustomHelpCommand(TyperCommand):
268
268
 
269
269
  console.print()
270
270
 
271
+ def get_help(self, ctx: ClickContext) -> str:
272
+ """Display Rich-formatted help and exit.
273
+
274
+ Overrides Click's get_help to display custom Rich output and
275
+ exit cleanly. This is the proper level to handle the exit,
276
+ not in format_help.
277
+
278
+ Args:
279
+ ctx: The Click context.
280
+
281
+ Returns:
282
+ Never returns — always raises Exit.
283
+
284
+ Raises:
285
+ Exit: After displaying help.
286
+ """
287
+ formatter = ctx.make_formatter()
288
+ self.format_help(ctx, formatter)
271
289
  raise Exit()
272
290
 
273
291
 
@@ -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}]")
File without changes
File without changes
File without changes
File without changes
File without changes