refactor: realizo parseo de flowconfig antes de ejecutar run, no en __init__
This commit is contained in:
@@ -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)
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user