From ce8365ebe7a5bfed0652b494114b78a18e5fe0d5 Mon Sep 17 00:00:00 2001 From: TheOnePath Date: Tue, 4 Jul 2023 20:52:59 +0100 Subject: [PATCH] Added soypakcli.py The soypak CLI interface module which handles arg parsing and the initialisation of soypak. --- soypak/cli/soypakcli.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 soypak/cli/soypakcli.py diff --git a/soypak/cli/soypakcli.py b/soypak/cli/soypakcli.py new file mode 100644 index 0000000..f6bfd2c --- /dev/null +++ b/soypak/cli/soypakcli.py @@ -0,0 +1,24 @@ +import sys +import soypak.cli.parser as parser + + +# :@TODO: remove this and implement the following: +# - a class which will auto-add commands to the CLI which can be ran (eopkg autocommand). +# - this will inherit `type` and be inherited as a metaclass `class ...(metaclass=...)` + +class SoypakCLI: + def __init__(self) -> None: + _parser = parser.SoypakParser() + cmd, args = _parser.parse_args() + + if len(args) == 0: + if _parser.namespace.version: + print(_parser.VERSION) + sys.exit(0) + + print(cmd, args) + + + def run(self): + # :@TODO: run commands + ...