Skip to content

Commit cb7b7e3

Browse files
author
dotfiles-bot
committed
upd
1 parent d421da5 commit cb7b7e3

1 file changed

Lines changed: 104 additions & 12 deletions

File tree

scripts/install.py

Lines changed: 104 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,11 @@ def main():
158158
# Instalar módulos específicos
159159
python install.py install modules/shell/bash modules/editors/vim
160160
161-
# Instalar con sanitización CRLF y permisos ejecutables
162-
python install.py install --fix-eol --fix-attributes modules/shell/bash
161+
# Verificar fuentes requeridas
162+
python install.py check-fonts
163+
164+
# Verificar git-lfs
165+
python install.py check-gitlfs
163166
164167
# Listar backups disponibles
165168
python install.py backup-list
@@ -169,16 +172,8 @@ def main():
169172
170173
# Limpiar backups antiguos (mantener últimos 5)
171174
python install.py backup-clean 5
172-
173-
# Actualizar submódulos (PKGBUILDs)
174-
python install.py update-submodules
175-
176-
# Inspeccionar mappings (debuggear YAML)
177-
python install.py inspect-mappings
178-
179-
# Configurar Git hooks personalizados
180-
python install.py setup-githooks
181175
176+
Para ayuda: python install.py --help o python install.py help
182177
Para ayuda de cada subcomando: python install.py <subcomando> --help
183178
'''.strip(),
184179
formatter_class=argparse.RawDescriptionHelpFormatter
@@ -189,6 +184,13 @@ def main():
189184
help='Subcomandos disponibles (usa <subcomando> --help para detalles)'
190185
)
191186

187+
# Subcomando: help (alias para --help)
188+
help_parser = subparsers.add_parser(
189+
'help',
190+
help='Mostrar ayuda general',
191+
description='Muestra la ayuda general del instalador'
192+
)
193+
192194
# Subcomando: install (default)
193195
install_parser = subparsers.add_parser(
194196
'install',
@@ -459,6 +461,68 @@ def main():
459461
help='Guardar reporte en archivo'
460462
)
461463

464+
# Subcomando: check-fonts
465+
fonts_parser = subparsers.add_parser(
466+
'check-fonts',
467+
help='Verificar e instalar fuentes requeridas',
468+
description='''
469+
Verifica que las fuentes requeridas estén instaladas.
470+
471+
Si faltan fuentes, ofrece instalarlas automáticamente usando
472+
el package manager de la distribución detectada.
473+
'''.strip(),
474+
epilog='''
475+
Ejemplos:
476+
477+
# Verificar fuentes (interactivo)
478+
python install.py check-fonts
479+
480+
# Verificar e instalar automáticamente
481+
python install.py check-fonts --non-interactive
482+
483+
# Incluir fuentes opcionales
484+
python install.py check-fonts --optional
485+
'''.strip(),
486+
formatter_class=argparse.RawDescriptionHelpFormatter
487+
)
488+
fonts_parser.add_argument(
489+
'--non-interactive',
490+
action='store_true',
491+
help='No preguntar antes de instalar (auto-instalar)'
492+
)
493+
fonts_parser.add_argument(
494+
'--optional',
495+
action='store_true',
496+
help='También verificar e instalar fuentes opcionales'
497+
)
498+
499+
# Subcomando: check-gitlfs
500+
gitlfs_parser = subparsers.add_parser(
501+
'check-gitlfs',
502+
help='Verificar e instalar git-lfs',
503+
description='''
504+
Verifica que git-lfs esté instalado.
505+
506+
Si no está instalado, ofrece instalarlo automáticamente usando
507+
el package manager de la distribución detectada.
508+
'''.strip(),
509+
epilog='''
510+
Ejemplos:
511+
512+
# Verificar git-lfs (interactivo)
513+
python install.py check-gitlfs
514+
515+
# Verificar e instalar automáticamente
516+
python install.py check-gitlfs --non-interactive
517+
'''.strip(),
518+
formatter_class=argparse.RawDescriptionHelpFormatter
519+
)
520+
gitlfs_parser.add_argument(
521+
'--non-interactive',
522+
action='store_true',
523+
help='No preguntar antes de instalar (auto-instalar)'
524+
)
525+
462526
# Subcomando: setup-githooks
463527
githooks_parser = subparsers.add_parser(
464528
'setup-githooks',
@@ -524,8 +588,15 @@ def main():
524588
args = parser.parse_args()
525589

526590
# Ejecutar subcomando
527-
if args.command == 'install':
591+
if args.command == 'help':
592+
parser.print_help()
593+
return 0
594+
elif args.command == 'install':
528595
return run_install(args)
596+
elif args.command == 'check-fonts':
597+
return run_check_fonts(args)
598+
elif args.command == 'check-gitlfs':
599+
return run_check_gitlfs(args)
529600
elif args.command == 'backup-list':
530601
return run_backup_list(args)
531602
elif args.command == 'backup-restore':
@@ -656,6 +727,27 @@ def run_install(args):
656727
return 0
657728

658729

730+
def run_check_fonts(args):
731+
"""Verificar e instalar fuentes requeridas."""
732+
from dotfiles_installer.fonts import check_and_install_fonts
733+
734+
installed, missing = check_and_install_fonts(
735+
interactive=not args.non_interactive,
736+
install_optional=args.optional
737+
)
738+
739+
# Exit code: 0 si todas las requeridas están, 1 si falta alguna
740+
return 0 if not missing else 1
741+
742+
743+
def run_check_gitlfs(args):
744+
"""Verificar e instalar git-lfs."""
745+
from dotfiles_installer.gitlfs import check_and_install_git_lfs
746+
747+
success = check_and_install_git_lfs(interactive=not args.non_interactive)
748+
return 0 if success else 1
749+
750+
659751
def run_backup_list(args):
660752
"""Listar backups disponibles."""
661753
from dotfiles_installer.backup import list_backups

0 commit comments

Comments
 (0)