refactor: migrar comando commit para que utilice questionary
This commit is contained in:
@@ -2,7 +2,7 @@ import typer
|
||||
from datetime import datetime
|
||||
from git_flow import COMMIT_TYPES, TRASH_BRANCH_PREFIX, WIP_BRANCH_PREFIX, GitFlowError
|
||||
from git_flow.git import Git
|
||||
from git_flow.command.base import *
|
||||
import git_flow.command.base as base
|
||||
|
||||
app = typer.Typer()
|
||||
|
||||
@@ -10,18 +10,18 @@ app = typer.Typer()
|
||||
@app.command()
|
||||
def commit():
|
||||
"""Crea un commit siguiendo el formato de Conventional Commits"""
|
||||
ensure_initialized()
|
||||
branch = ensure_right_branch()
|
||||
base.ensure_initialized()
|
||||
branch = base.ensure_right_branch()
|
||||
|
||||
if not _has_files_staged():
|
||||
warning("No hay cambios en el indice para commitear.")
|
||||
if confirm("¿Desea agregar la carpeta actual?"):
|
||||
base.io_warning("No hay cambios en el indice para commitear.")
|
||||
if base.io_confirm("¿Desea agregar la carpeta actual?"):
|
||||
Git("add", ".").exec(print="Agregando cambios")
|
||||
else:
|
||||
raise GitFlowError("Debe agregar algún cambio al indice para continuar.")
|
||||
|
||||
commit_type = choice("Tipo de commit", COMMIT_TYPES)
|
||||
commit_message = prompt(
|
||||
commit_type = base.io_choice("Tipo de commit", COMMIT_TYPES)
|
||||
commit_message = base.io_prompt(
|
||||
"Mensaje (máximo recomendado: 100 caracteres)", persistent=True
|
||||
)
|
||||
message = commit_type + ": " + commit_message
|
||||
|
||||
Reference in New Issue
Block a user