refactor: use base.io_ methods

This commit is contained in:
jt
2026-07-17 22:01:42 -03:00
parent 919e680e75
commit 07d4ff960e
+13 -12
View File
@@ -3,15 +3,16 @@ from git_flow import (
WIP_BRANCH_PREFIX,
GitFlowError,
)
from git_flow.command.base import *
import git_flow.command.base as base
from git_flow.git import Git
from typing import Annotated
import typer
from rich.console import Console
BRANCH_FORMAT = "%(refname:short)"
app = typer.Typer()
console = Console()
@app.command()
def branch(
@@ -38,28 +39,28 @@ def branch(
] = False,
):
"""Lista ramas del repositorio, agrupandolas por entorno objetivo"""
ensure_initialized()
base.ensure_initialized()
current_branch = Git.get_current_branch()
if current_branch in environments:
if current_branch in base.environments:
current_environment = current_branch
else:
current_environment, _ = get_branch_env_and_type(current_branch)
current_environment, _ = base.get_branch_env_and_type(current_branch)
if trash:
show_branches(TRASH_BRANCH_PREFIX, current_branch)
elif wip:
show_branches(WIP_BRANCH_PREFIX, current_branch)
elif all:
show_envs(environments, current_branch)
show_all_branches(environments, current_branch)
show_envs(base.environments, current_branch)
show_all_branches(base.environments, current_branch)
elif environment is None:
show_envs(environments, current_branch)
show_env_branches(current_environment, environments, current_branch)
elif environment in environments:
show_envs(environments, current_branch)
show_env_branches(environment, environments, current_branch)
show_envs(base.environments, current_branch)
show_env_branches(current_environment, base.environments, current_branch)
elif environment in base.environments:
show_envs(base.environments, current_branch)
show_env_branches(environment, base.environments, current_branch)
else:
raise GitFlowError(f"'{environment}' no es un entorno válido.")