From 9139032a0eb3d823e08e339a0255621237f1760f Mon Sep 17 00:00:00 2001 From: ldericher Date: Thu, 6 Aug 2020 14:55:27 +0200 Subject: [PATCH] "kiwi show" --- kiwi.yml | 2 +- src/default.kiwi.yml | 3 +-- src/kiwi/runner.py | 3 ++- src/kiwi/subcommands/__init__.py | 6 ++++-- src/kiwi/subcommands/show.py | 21 +++++++++++++++++++++ 5 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 src/kiwi/subcommands/show.py diff --git a/kiwi.yml b/kiwi.yml index 71e7332..57bf16d 100644 --- a/kiwi.yml +++ b/kiwi.yml @@ -1 +1 @@ -version: 0.1 \ No newline at end of file +version: '0.1' \ No newline at end of file diff --git a/src/default.kiwi.yml b/src/default.kiwi.yml index 24013a4..b642fda 100644 --- a/src/default.kiwi.yml +++ b/src/default.kiwi.yml @@ -10,5 +10,4 @@ network: cidr: 10.22.46.0/24 runtime: storage: /var/kiwi - env: - HELLO_KIWI: Hello World! + env: null diff --git a/src/kiwi/runner.py b/src/kiwi/runner.py index ecb9e22..c51606a 100644 --- a/src/kiwi/runner.py +++ b/src/kiwi/runner.py @@ -6,7 +6,8 @@ from .subcommands import * class Runner: __commands: List[SubCommand] = [ - InitCommand + InitCommand, + ShowCommand ] @classmethod diff --git a/src/kiwi/subcommands/__init__.py b/src/kiwi/subcommands/__init__.py index cdf8394..a8cc797 100644 --- a/src/kiwi/subcommands/__init__.py +++ b/src/kiwi/subcommands/__init__.py @@ -1,4 +1,6 @@ from .subcommand import SubCommand -from .init import InitCommand -__all__ = ['InitCommand', 'SubCommand'] \ No newline at end of file +from .init import InitCommand +from .show import ShowCommand + +__all__ = ['SubCommand', 'InitCommand', 'ShowCommand'] \ No newline at end of file diff --git a/src/kiwi/subcommands/show.py b/src/kiwi/subcommands/show.py new file mode 100644 index 0000000..34b7df9 --- /dev/null +++ b/src/kiwi/subcommands/show.py @@ -0,0 +1,21 @@ +from kiwi.config import Config +from kiwi.core import Parser + +from .subcommand import SubCommand + + +class ShowCommand(SubCommand): + __parser = None + + @classmethod + def get_cmd(cls): + return 'show' + + @classmethod + def setup(cls): + cls.__parser = Parser.get_subparsers().add_parser(cls.get_cmd(), help="Show effective kiwi.yml") + + @classmethod + def run(cls): + config = Config.load() + print(config)