refactor: use questionary package #1

Merged
jt merged 3 commits from refactor/use-questionary-package into main 2026-07-14 03:32:09 +00:00
Showing only changes of commit 320d40a211 - Show all commits
+7 -7
View File
@@ -2,7 +2,7 @@ import typer
from datetime import datetime from datetime import datetime
from git_flow import COMMIT_TYPES, TRASH_BRANCH_PREFIX, WIP_BRANCH_PREFIX, GitFlowError from git_flow import COMMIT_TYPES, TRASH_BRANCH_PREFIX, WIP_BRANCH_PREFIX, GitFlowError
from git_flow.git import Git from git_flow.git import Git
from git_flow.command.base import * import git_flow.command.base as base
app = typer.Typer() app = typer.Typer()
@@ -10,18 +10,18 @@ app = typer.Typer()
@app.command() @app.command()
def commit(): def commit():
"""Crea un commit siguiendo el formato de Conventional Commits""" """Crea un commit siguiendo el formato de Conventional Commits"""
ensure_initialized() base.ensure_initialized()
branch = ensure_right_branch() branch = base.ensure_right_branch()
if not _has_files_staged(): if not _has_files_staged():
warning("No hay cambios en el indice para commitear.") base.io_warning("No hay cambios en el indice para commitear.")
if confirm("¿Desea agregar la carpeta actual?"): if base.io_confirm("¿Desea agregar la carpeta actual?"):
Git("add", ".").exec(print="Agregando cambios") Git("add", ".").exec(print="Agregando cambios")
else: else:
raise GitFlowError("Debe agregar algún cambio al indice para continuar.") raise GitFlowError("Debe agregar algún cambio al indice para continuar.")
commit_type = choice("Tipo de commit", COMMIT_TYPES) commit_type = base.io_choice("Tipo de commit", COMMIT_TYPES)
commit_message = prompt( commit_message = base.io_prompt(
"Mensaje (máximo recomendado: 100 caracteres)", persistent=True "Mensaje (máximo recomendado: 100 caracteres)", persistent=True
) )
message = commit_type + ": " + commit_message message = commit_type + ": " + commit_message