nametitleapp 0.1.0__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.
@@ -0,0 +1,21 @@
1
+ # MIT License
2
+
3
+ Copyright (c) 2026 Francisco Garcia
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,17 @@
1
+ Metadata-Version: 2.4
2
+ Name: nametitleapp
3
+ Version: 0.1.0
4
+ Summary:
5
+ License-File: LICENSE
6
+ Author: CiszukoAntony
7
+ Author-email: fplayersoffcial@gmail.com
8
+ Requires-Python: >=3.14
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.14
11
+ Requires-Dist: keyboard (>=0.13.5)
12
+ Requires-Dist: rich (>=15.0.0)
13
+ Requires-Dist: typer (>=0.27.2,<0.28.0)
14
+ Description-Content-Type: text/markdown
15
+
16
+ README
17
+
@@ -0,0 +1 @@
1
+ README
@@ -0,0 +1,18 @@
1
+ [project]
2
+ name = "nametitleapp"
3
+ version = "0.1.0"
4
+ description = ""
5
+ authors = [{ name = "CiszukoAntony", email = "fplayersoffcial@gmail.com" }]
6
+ readme = "README.md"
7
+ requires-python = ">=3.14"
8
+ dependencies = ["keyboard>=0.13.5", "rich>=15.0.0", "typer (>=0.27.2,<0.28.0)"]
9
+
10
+ [tool.poetry]
11
+ packages = [{ include = "*", from = "src" }]
12
+
13
+ [build-system]
14
+ requires = ["poetry-core>=2.0.0,<3.0.0"]
15
+ build-backend = "poetry.core.masonry.api"
16
+
17
+ [tool.poetry.scripts]
18
+ nametitleapp = "main:app"
File without changes
@@ -0,0 +1,104 @@
1
+ # ruff: noqa: I001
2
+ # ruff: noqa: BLE001
3
+
4
+ # Imports
5
+ import os
6
+ import sys
7
+ import threading as thr
8
+ import time
9
+ import typing
10
+ import keyboard as kb
11
+ import typer
12
+ from modules import clear_cls_command, hotkeys, install_libs
13
+ from rich import print
14
+
15
+ install_libs.installlibs("rich", "keyboard", "typer")
16
+ clear_cls_command.clear_cls()
17
+
18
+ # Inicializamos la aplicación Typer
19
+ app = typer.Typer(help="NameTitleApp CLI con Typer")
20
+
21
+
22
+ def run_app(name: str) -> None:
23
+ """
24
+ Logica central de la aplicacion que ejecuta los hilos y espera la salida.
25
+ """
26
+ thr_clearcls = thr.Thread(target=clear_cls_command.clear_cls)
27
+ thr_inithotkeys = thr.Thread(target=hotkeys.init_hotkeys)
28
+
29
+ thr_clearcls.start()
30
+ time.sleep(0.1)
31
+ thr_inithotkeys.start()
32
+ time.sleep(0.1)
33
+
34
+ print(f"Bienvenido. {name}.")
35
+
36
+ print("Presiona [ESC] para terminar.")
37
+ kb.wait("esc")
38
+
39
+
40
+ # Callback principal: Maneja el comando base, argumentos de nombre y la flag --debug
41
+ @app.callback(invoke_without_command=True)
42
+ def main(
43
+ ctx: typer.Context,
44
+ name_arg: str | None = typer.Argument(
45
+ None, help="Nombre ingresado directamente por argumento"
46
+ ),
47
+ debug: bool = typer.Option(
48
+ False,
49
+ "--debug",
50
+ help="Activa el modo debug (asigna nombre admin automáticamente)",
51
+ ),
52
+ ) -> typing.Any:
53
+ """
54
+ Funcion principal con soporte para argumentos directos y flags.
55
+ """
56
+ # Si el usuario ejecuta un subcomando (ej. 'init' o 'run'), dejamos que actúe dicho subcomando
57
+ if ctx.invoked_subcommand is not None:
58
+ return
59
+
60
+ # Evaluamos la logica de negocio
61
+ if debug:
62
+ name = "Admin"
63
+ elif name_arg:
64
+ name = name_arg.strip().title()
65
+ else:
66
+ name = str(input("Ingresa tu nombre: ")).strip().title()
67
+
68
+ run_app(name)
69
+
70
+
71
+ # Subcomando 'init' (ej: nametitleapp init)
72
+ @app.command()
73
+ def init(
74
+ debug: bool = typer.Option(False, "--debug", help="Activa el modo debug en init"),
75
+ ) -> None:
76
+ """Subcomando init."""
77
+ name = (
78
+ "Admin"
79
+ if debug
80
+ else str(input("Ingresa tu nombre para init: ")).strip().title()
81
+ )
82
+ run_app(name)
83
+
84
+
85
+ # Subcomando 'run' (ej: nametitleapp run)
86
+ @app.command()
87
+ def run(
88
+ debug: bool = typer.Option(False, "--debug", help="Activa el modo debug en run"),
89
+ ) -> None:
90
+ """Subcomando run."""
91
+ name = (
92
+ "Admin" if debug else str(input("Ingresa tu nombre para run: ")).strip().title()
93
+ )
94
+ run_app(name)
95
+
96
+
97
+ if __name__ == "__main__":
98
+ try:
99
+ app()
100
+ except Exception as exc:
101
+ print(
102
+ f"\n[ERROR CRÍTICO]: {os.strerror(exc.errno) if hasattr(exc, 'errno') else exc}"
103
+ )
104
+ sys.exit(1)
@@ -0,0 +1,27 @@
1
+ # ruff: noqa: RUF100
2
+ # ruff: noqa: I001
3
+ # ruff:noqa: BLE001
4
+
5
+ # Imports
6
+ import os
7
+ import sys
8
+
9
+ from rich import print
10
+
11
+
12
+ def clear_cls() -> None:
13
+ """
14
+ Borra la consola.
15
+ """
16
+ clear_command = "cls" if os.name == "nt" else "clear"
17
+ os.system(clear_command)
18
+
19
+
20
+ if __name__ == "__main__":
21
+ try:
22
+ print("No se puede ejecutar este modulo por separado.")
23
+ except Exception as exc:
24
+ print(
25
+ f"\n[ERROR CRÍTICO]: {os.strerror(exc.errno) if hasattr(exc, 'errno') else exc}"
26
+ )
27
+ sys.exit(1)
@@ -0,0 +1,33 @@
1
+ # ruff: noqa: RUF100
2
+ # ruff: noqa: I001
3
+ # ruff:noqa: BLE001
4
+
5
+ # Imports
6
+ import os
7
+ import sys
8
+
9
+ import keyboard as kb
10
+ from rich import print
11
+
12
+
13
+ def init_hotkeys() -> None:
14
+ """
15
+ Funcion que inicializa los hotkeys.
16
+ """
17
+ print("Usa CONTROL+Z para Cerrar la App")
18
+
19
+ def ctrl_z_func():
20
+ print("\nCerrado App...")
21
+ os._exit(1)
22
+
23
+ kb.add_hotkey(hotkey="ctrl+z", callback=ctrl_z_func)
24
+
25
+
26
+ if __name__ == "__main__":
27
+ try:
28
+ print("No se puede ejecutar este modulo por separado.")
29
+ except Exception as exc:
30
+ print(
31
+ f"\n[ERROR CRÍTICO]: {os.strerror(exc.errno) if hasattr(exc, 'errno') else exc}"
32
+ )
33
+ sys.exit(1)
@@ -0,0 +1,44 @@
1
+ # ruff: noqa: RUF100
2
+ # ruff: noqa: I001
3
+ # ruff:noqa: BLE001
4
+
5
+ # Imports
6
+ import importlib
7
+ import os
8
+ import subprocess
9
+ import sys
10
+
11
+ from rich import print
12
+
13
+
14
+ def installlibs(*librerias: str) -> None:
15
+ """
16
+ Verifica e instala dinámicamente las librerías que falten.
17
+ """
18
+ for lib in librerias:
19
+ nombre_paquete = lib.split(".")[0]
20
+
21
+ try:
22
+ importlib.import_module(nombre_paquete)
23
+ print(f"[OK] La librería '{lib}' ya está instalada.")
24
+ except ImportError:
25
+ print(f"[AVISO] La librería '{lib}' no está instalada. Instalando...")
26
+ try:
27
+ subprocess.check_call(
28
+ [sys.executable, "-m", "pip", "install", nombre_paquete]
29
+ )
30
+ print(f"[ÉXITO] '{nombre_paquete}' se instaló correctamente.")
31
+ except Exception as e:
32
+ raise ImportError(
33
+ f"[ERROR CRÍTICO] No se pudo instalar '{nombre_paquete}'. Motivo: {e}"
34
+ )
35
+
36
+
37
+ if __name__ == "__main__":
38
+ try:
39
+ print("No se puede ejecutar este modulo por separado.")
40
+ except Exception as exc:
41
+ print(
42
+ f"\n[ERROR CRÍTICO]: {os.strerror(exc.errno) if hasattr(exc, 'errno') else exc}"
43
+ )
44
+ sys.exit(1)