refactor: use base.io_ methods
This commit is contained in:
@@ -3,15 +3,16 @@ from git_flow import (
|
|||||||
WIP_BRANCH_PREFIX,
|
WIP_BRANCH_PREFIX,
|
||||||
GitFlowError,
|
GitFlowError,
|
||||||
)
|
)
|
||||||
from git_flow.command.base import *
|
import git_flow.command.base as base
|
||||||
from git_flow.git import Git
|
from git_flow.git import Git
|
||||||
from typing import Annotated
|
from typing import Annotated
|
||||||
import typer
|
import typer
|
||||||
|
from rich.console import Console
|
||||||
|
|
||||||
BRANCH_FORMAT = "%(refname:short)"
|
BRANCH_FORMAT = "%(refname:short)"
|
||||||
|
|
||||||
app = typer.Typer()
|
app = typer.Typer()
|
||||||
|
console = Console()
|
||||||
|
|
||||||
@app.command()
|
@app.command()
|
||||||
def branch(
|
def branch(
|
||||||
@@ -38,28 +39,28 @@ def branch(
|
|||||||
] = False,
|
] = False,
|
||||||
):
|
):
|
||||||
"""Lista ramas del repositorio, agrupandolas por entorno objetivo"""
|
"""Lista ramas del repositorio, agrupandolas por entorno objetivo"""
|
||||||
ensure_initialized()
|
base.ensure_initialized()
|
||||||
|
|
||||||
current_branch = Git.get_current_branch()
|
current_branch = Git.get_current_branch()
|
||||||
|
|
||||||
if current_branch in environments:
|
if current_branch in base.environments:
|
||||||
current_environment = current_branch
|
current_environment = current_branch
|
||||||
else:
|
else:
|
||||||
current_environment, _ = get_branch_env_and_type(current_branch)
|
current_environment, _ = base.get_branch_env_and_type(current_branch)
|
||||||
|
|
||||||
if trash:
|
if trash:
|
||||||
show_branches(TRASH_BRANCH_PREFIX, current_branch)
|
show_branches(TRASH_BRANCH_PREFIX, current_branch)
|
||||||
elif wip:
|
elif wip:
|
||||||
show_branches(WIP_BRANCH_PREFIX, current_branch)
|
show_branches(WIP_BRANCH_PREFIX, current_branch)
|
||||||
elif all:
|
elif all:
|
||||||
show_envs(environments, current_branch)
|
show_envs(base.environments, current_branch)
|
||||||
show_all_branches(environments, current_branch)
|
show_all_branches(base.environments, current_branch)
|
||||||
elif environment is None:
|
elif environment is None:
|
||||||
show_envs(environments, current_branch)
|
show_envs(base.environments, current_branch)
|
||||||
show_env_branches(current_environment, environments, current_branch)
|
show_env_branches(current_environment, base.environments, current_branch)
|
||||||
elif environment in environments:
|
elif environment in base.environments:
|
||||||
show_envs(environments, current_branch)
|
show_envs(base.environments, current_branch)
|
||||||
show_env_branches(environment, environments, current_branch)
|
show_env_branches(environment, base.environments, current_branch)
|
||||||
else:
|
else:
|
||||||
raise GitFlowError(f"'{environment}' no es un entorno válido.")
|
raise GitFlowError(f"'{environment}' no es un entorno válido.")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user