From f5b69badd4c32511ac23c2991793c8b014095399 Mon Sep 17 00:00:00 2001 From: Jon Michael Aanes Date: Mon, 22 Jul 2024 14:53:48 +0200 Subject: [PATCH] Basic CLI --- crypto_seller/__main__.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/crypto_seller/__main__.py b/crypto_seller/__main__.py index 088f214..e01b527 100644 --- a/crypto_seller/__main__.py +++ b/crypto_seller/__main__.py @@ -1,10 +1,12 @@ import datetime import logging import logging.handlers +import argparse import time from decimal import Decimal import fin_defs +import fin_depo from . import PATH_LOG_FILE, AutoSellConfig, config, run_auto_sell, log_results from . import logger as module_logger @@ -13,6 +15,7 @@ logger = logging.getLogger(__name__) def setup_logging(): + """Enables logging for the terminal and to a log file.""" PATH_LOG_FILE.parent.mkdir(parents=True, exist_ok=True) file_handler = logging.handlers.WatchedFileHandler(filename=PATH_LOG_FILE) file_handler.setFormatter( @@ -27,9 +30,20 @@ def setup_logging(): logger.setLevel('INFO') module_logger.setLevel('INFO') +CLI_DESCRIPTION = """ +Sells financial assets from an online account. +""".strip() + +def parse_args(): + parser = argparse.ArgumentParser('crypto_seller', description = CLI_DESCRIPTION) + return parser.parse_args() def main(): + """Initializes the program.""" setup_logging() + + args = parse_args() + logger.info('Initializing crypto_seller') seller_backend = fin_depo.defi_kucoin.KucoinDepoFetcher(