Merged in refactor/read-flowconfig-before-run (pull request #30)

refactor: read flowconfig before run

Approved-by: Jonathan Teran
This commit is contained in:
JonathanGitFlow
2025-11-21 23:48:58 +00:00
committed by jt
2 changed files with 5 additions and 6 deletions
+2 -5
View File
@@ -31,6 +31,8 @@ TYPE_INFO = 3
class Command(ABC): class Command(ABC):
flowconfig: dict[str, str]
@abstractmethod @abstractmethod
def name(self) -> str: def name(self) -> str:
pass pass
@@ -43,11 +45,6 @@ class Command(ABC):
def run(self, args: Namespace = Namespace()): def run(self, args: Namespace = Namespace()):
pass pass
def __init__(self) -> None:
self.flowconfig = (
Git.get_config(FLOWCONFIG_FILE) if isfile(FLOWCONFIG_FILE) else {}
)
def success(self, msg: str): def success(self, msg: str):
self._print(TYPE_SUCCESS, msg) self._print(TYPE_SUCCESS, msg)
+3 -1
View File
@@ -1,6 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import os import os
from os.path import isfile
import sys import sys
import datetime import datetime
import requests import requests
@@ -15,7 +16,7 @@ from git_flow.command.init import InitCommand
from git_flow.command.merge import MergeCommand from git_flow.command.merge import MergeCommand
from git_flow.command.new import NewCommand from git_flow.command.new import NewCommand
from git_flow.command.tag import TagCommand from git_flow.command.tag import TagCommand
from git_flow.git import BUMP_VERSION, Git from git_flow.git import BUMP_VERSION, FLOWCONFIG_FILE, Git
from git_flow.io import * from git_flow.io import *
@@ -54,6 +55,7 @@ class GitFlowCommand(Command):
for command in self.commands: for command in self.commands:
if command.name() == args.command: if command.name() == args.command:
command.flowconfig = Git.get_config(FLOWCONFIG_FILE) if isfile(FLOWCONFIG_FILE) else {}
return command.run(args) return command.run(args)