TSNDep/tsndep/Comands/Consultas.py
Nique_372 c0c2855891 # Actulizacion importante en el gestor tsndep
- Correcion de export
- Correcion de update\install
- Se agrego las variables ENV con sintaxis "${{}}"
2026-04-27 07:30:55 -05:00

54 lines
2.3 KiB
Python

#+------------------------------------------------------------------+
#| Imports |
#+------------------------------------------------------------------+
# Importamos todo
from .Defines import *
#+------------------------------------------------------------------+
#| |
#+------------------------------------------------------------------+
@tsndep.command()
@click.option('--depth', required=False, type=int, default=10, help='Maximum depth')
def list(depth):
"""Create dependency tree up to specified depth"""
root_path : str = os.getcwd()
repo_name : str = os.path.basename(root_path)
current_depth : int = 0
click.echo(f"[LIST:{repo_name}] {repo_name}/")
GitCommands.imprimir_dependencias_repo(os.path.dirname(root_path), root_path, "", current_depth, max_depth=depth)
#+------------------------------------------------------------------+
#| |
#+------------------------------------------------------------------+
@tsndep.command()
def check():
"""Check dependencies and the repository itself"""
GitCommands.check_repo(os.getcwd())
#+------------------------------------------------------------------+
#| |
#+------------------------------------------------------------------+
@tsndep.command()
@click.option('--output', required=False, type=str, default='dependencies-exported.json', help='Output filename relative to execution')
def export(output):
"""Export all dependencies"""
repo_path : str = os.getcwd()
repo_name : str = os.path.basename(repo_path)
click.echo(f"[EXPORT:{repo_name}] Exporting dependencies...")
exported_data : dict = JsonV.export_dependencies(repo_path, os.path.dirname(repo_path))
# Guardar archivo
output_path : str = os.path.join(repo_path, output)
if JsonV.save_json(output_path, exported_data):
click.echo(f"[EXPORT:{repo_name}] Exported to: {output_path}")
click.echo(f"[EXPORT:{repo_name}] Total dependencies: {exported_data['_metadata']['total_deps']}")
else:
click.echo(f"[EXPORT:{repo_name}] Error saving file", err=True)