refactor: use direct registry export and migrate methods to public scope
This commit is contained in:
13
main.py
13
main.py
@@ -3,12 +3,11 @@
|
|||||||
import sys
|
import sys
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
from skywipe.commands import get_registry
|
from skywipe.commands import registry
|
||||||
from skywipe.configure import Configuration
|
from skywipe.configure import Configuration
|
||||||
|
|
||||||
|
|
||||||
def _create_parser():
|
def create_parser():
|
||||||
registry = get_registry()
|
|
||||||
commands = registry.get_all_commands()
|
commands = registry.get_all_commands()
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
@@ -29,7 +28,7 @@ def _create_parser():
|
|||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
|
||||||
def _require_config():
|
def require_config():
|
||||||
config = Configuration()
|
config = Configuration()
|
||||||
if not config.exists():
|
if not config.exists():
|
||||||
print("Error: Configuration file not found.")
|
print("Error: Configuration file not found.")
|
||||||
@@ -38,13 +37,11 @@ def _require_config():
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = _create_parser()
|
parser = create_parser()
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
registry = get_registry()
|
|
||||||
|
|
||||||
if registry.requires_config(args.command):
|
if registry.requires_config(args.command):
|
||||||
_require_config()
|
require_config()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
registry.execute(args.command)
|
registry.execute(args.command)
|
||||||
|
|||||||
Reference in New Issue
Block a user