From 6ea5e6ed7695cb703f5d53af5ff094bc5a172c86 Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Mon, 3 Jun 2024 18:37:17 +0200 Subject: [PATCH] smoke test working --- pyproject.toml | 4 +++- xexe/cli.py | 39 +++++++++++++++++++++++++++++++++++++++ xexe/constants.py | 7 +++++++ 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 xexe/cli.py create mode 100644 xexe/constants.py diff --git a/pyproject.toml b/pyproject.toml index 12383ad..cdc89e1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,9 @@ click = "^8.1.7" python-dotenv = "^1.0.1" pyfiglet = "^1.0.2" - [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" + +[tool.poetry.scripts] +xexe = "xexe.cli:cli" \ No newline at end of file diff --git a/xexe/cli.py b/xexe/cli.py new file mode 100644 index 0000000..c8d388c --- /dev/null +++ b/xexe/cli.py @@ -0,0 +1,39 @@ +import importlib.metadata +import logging + +import click +import pyfiglet +from dotenv import load_dotenv + +from xexe.constants import PATHS + +logging.basicConfig( + level=logging.DEBUG, + format="%(asctime)s - [%(levelname)s] - %(filename)s - L%(lineno)d - %(message)s", + handlers=[logging.FileHandler(PATHS.logging_file), logging.StreamHandler()], +) + +logger = logging.getLogger() + +load_dotenv() + + +@click.group() +def cli(): + logger.info(pyfiglet.figlet_format("Welcome to xexe", font="big")) + logger.info(f"Running xexe version: {importlib.metadata.version('xexe')}") + + +@cli.command() +def smoke_test(): + print("Oink oink!") + print( + """ + __,---.__ + ,-' `-.__ + &/ `._\ _\\ + / ''._ + | , (") + |__,'`-..--|__|--'' + """ + ) diff --git a/xexe/constants.py b/xexe/constants.py new file mode 100644 index 0000000..78f03f0 --- /dev/null +++ b/xexe/constants.py @@ -0,0 +1,7 @@ +import pathlib +from dataclasses import dataclass + + +@dataclass +class PATHS: + logging_file: pathlib.Path = pathlib.Path("xexe.log")