From d7f2e569da981fd6c557f83a46016eebac436d7a Mon Sep 17 00:00:00 2001 From: Jonathan Teran Carballo Date: Mon, 21 Sep 2026 13:37:05 -0300 Subject: [PATCH] feature: remove file parameter on status report --- src/git_flow/command/base.py | 37 +++++++++++++++++------------------- src/git_flow/command/tag.py | 2 -- 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/src/git_flow/command/base.py b/src/git_flow/command/base.py index da4d7b0..7a4ae7b 100644 --- a/src/git_flow/command/base.py +++ b/src/git_flow/command/base.py @@ -1,26 +1,24 @@ -import sys +from os.path import isfile + +import questionary +import rich +import rich.panel from git_flow import ( BRANCH_TYPES, - REPOSITORY_TOKEN_FILENAME, + COMMIT_TYPES, FLOWCONFIG_FILENAME, FLOWCONFIG_VERSION, - COMMIT_TYPES, + REPOSITORY_TOKEN_FILENAME, GitFlowError, ) from git_flow.git import Git +from git_flow.io import * from git_flow.remote.base import RemoteAPI from git_flow.remote.bitbucket import BitbucketRemoteAPI -from git_flow.remote.github import GithubRemoteAPI from git_flow.remote.gitea import GiteaRemoteAPI +from git_flow.remote.github import GithubRemoteAPI from git_flow.remote.gitlab import GitlabRemoteAPI -from git_flow.io import * -from os.path import isfile - -from typing import Optional -import rich -import rich.panel -import questionary flowconfig = Git.get_config(FLOWCONFIG_FILENAME) if isfile(FLOWCONFIG_FILENAME) else {} environments = ( @@ -104,7 +102,7 @@ def ensure_clean_worktree(has_remote: bool): if not status: return - not_empty = any(map(lambda s: s.index != " " or s.worktree != " ", status)) + not_empty = any(s.index != " " or s.worktree != " " for s in status) if not_empty: if not has_remote: @@ -164,23 +162,23 @@ def get_commit_message(commit_types: list[str] = COMMIT_TYPES) -> str: return commit_type + ": " + commit_message -def io_error(message: str, title: Optional[str] = None): - _io_status(message, "✖ Error: ", "red", title, file=sys.stderr) +def io_error(message: str, title: str | None = None): + _io_status(message, "✖ Error: ", "red", title) -def io_warning(message: str, title: Optional[str] = None): +def io_warning(message: str, title: str | None = None): _io_status(message, "⚠ Warning: ", "yellow", title) -def io_info(message: str, title: Optional[str] = None): +def io_info(message: str, title: str | None = None): _io_status(message, "ℹ Info: ", "blue", title) -def io_success(message: str, title: Optional[str] = None): +def io_success(message: str, title: str | None = None): _io_status(message, "✔ Success: ", "green", title) -def _io_status(message: str, prefix: str, style: str, title: Optional[str] = None, file=None): +def _io_status(message: str, prefix: str, style: str, title: str | None = None): if title: rich.print( rich.panel.Panel( @@ -189,8 +187,7 @@ def _io_status(message: str, prefix: str, style: str, title: Optional[str] = Non style=style, expand=False, title_align="left", - ), - file=file + ) ) else: rich.print(f"[{style}]{prefix}{message}[/{style}]") diff --git a/src/git_flow/command/tag.py b/src/git_flow/command/tag.py index 74e26c9..41f7227 100644 --- a/src/git_flow/command/tag.py +++ b/src/git_flow/command/tag.py @@ -1,5 +1,3 @@ -from typing import Optional - import typer from git_flow import ( -- 2.54.0