From 5ece118c05cb31a2f7ba175ede6cd839ba4ef7d3 Mon Sep 17 00:00:00 2001 From: Jonathan Teran Carballo Date: Tue, 22 Sep 2026 01:20:33 -0300 Subject: [PATCH] refactor: move branch command to branch ls subcommand --- README.md | 4 ++-- src/git_flow/command/branch/__init__.py | 6 ++++++ src/git_flow/command/{branch.py => branch/ls.py} | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 src/git_flow/command/branch/__init__.py rename src/git_flow/command/{branch.py => branch/ls.py} (98%) diff --git a/README.md b/README.md index 80c6486..bf0e71d 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ más información): - `merge`: Mergea la rama actual a una de las ramas principales. - `tag`: Crea un tag sobre el ultimo merge siguiendo SemVer (ver [Tag](#tag)). - `release`: Prepara la rama actual para pasarse al siguiente entorno configurado. -- `branch`: Lista las ramas del repositorio, agrupadas por entorno objetivo. +- `branch ls`: Lista las ramas del repositorio, agrupadas por entorno objetivo. El workflow para el cual se penso la herramienta es el siguiente: @@ -88,7 +88,7 @@ El workflow para el cual se penso la herramienta es el siguiente: `feature/my-new-feature`, se crea la rama `release/test/feature/my-new-feature` sobre `test` que tiene los cambios de la rama original. -En cualquier momento se puede usar `git-flow branch` para ver en qué entorno está cada rama, y cuáles +En cualquier momento se puede usar `git-flow branch ls` para ver en qué entorno está cada rama, y cuáles están todavía en progreso (`wip/`) o descartadas (`trash/`). ### Tag diff --git a/src/git_flow/command/branch/__init__.py b/src/git_flow/command/branch/__init__.py new file mode 100644 index 0000000..219afcf --- /dev/null +++ b/src/git_flow/command/branch/__init__.py @@ -0,0 +1,6 @@ +import typer + +from git_flow.command.branch import ls + +app = typer.Typer(name="branch") +app.add_typer(ls.app) diff --git a/src/git_flow/command/branch.py b/src/git_flow/command/branch/ls.py similarity index 98% rename from src/git_flow/command/branch.py rename to src/git_flow/command/branch/ls.py index 1c78dc3..4b07696 100644 --- a/src/git_flow/command/branch.py +++ b/src/git_flow/command/branch/ls.py @@ -3,12 +3,12 @@ from typing import Annotated import typer from rich.console import Console -import git_flow.command.base as base from git_flow import ( TRASH_BRANCH_PREFIX, WIP_BRANCH_PREFIX, GitFlowError, ) +from git_flow.command import base from git_flow.git import Git BRANCH_FORMAT = "%(refname:short)" @@ -18,7 +18,7 @@ console = Console() @app.command() -def branch( +def ls( environment: Annotated[ str | None, typer.Argument(