[BACKEND] Add --version arg
This commit is contained in:
parent
5d40d02eb3
commit
546def809b
4 changed files with 6 additions and 4 deletions
|
|
@ -125,6 +125,7 @@ def main() -> List[Tuple[Subscription, FileHandlerTransactionLog]]:
|
|||
|
||||
args, extra_args = parser.parse_known_args()
|
||||
|
||||
# Load the config
|
||||
config: ConfigFile = ConfigFile.from_file_path(args.config).initialize()
|
||||
transaction_logs: List[Tuple[Subscription, FileHandlerTransactionLog]] = []
|
||||
|
||||
|
|
@ -154,6 +155,4 @@ def main() -> List[Tuple[Subscription, FileHandlerTransactionLog]]:
|
|||
transaction_log.to_output_message(subscription.output_directory),
|
||||
)
|
||||
|
||||
# Ran successfully, so we can delete the debug file
|
||||
Logger.cleanup(delete_debug_file=True)
|
||||
return transaction_logs
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import argparse
|
|||
from enum import Enum
|
||||
from typing import List
|
||||
|
||||
from ytdl_sub import __local_version__
|
||||
from ytdl_sub.utils.logger import LoggerLevels
|
||||
|
||||
|
||||
|
|
@ -25,6 +26,7 @@ class MainArgs(Enum):
|
|||
parser = argparse.ArgumentParser(
|
||||
description="ytdl-sub: Automate download and adding metadata with YoutubeDL"
|
||||
)
|
||||
parser.add_argument("--version", action="version", version="%(prog)s " + __local_version__)
|
||||
parser.add_argument(
|
||||
"-c",
|
||||
MainArgs.CONFIG.value,
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ def main():
|
|||
logger = Logger.get()
|
||||
try:
|
||||
_main()
|
||||
Logger.cleanup() # Ran successfully, so we can delete the debug file
|
||||
except ValidationException as validation_exception:
|
||||
logger.error(validation_exception)
|
||||
sys.exit(1)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ from ytdl_sub.utils.logger import LoggerLevels
|
|||
def cleanup_debug_file():
|
||||
Logger.set_log_level(log_level_name=LoggerLevels.DEBUG.name)
|
||||
yield
|
||||
Logger.cleanup(delete_debug_file=True)
|
||||
Logger.cleanup()
|
||||
|
||||
|
||||
class TestLogger:
|
||||
|
|
@ -98,7 +98,7 @@ class TestLogger:
|
|||
for handler in logger.handlers:
|
||||
handler.close()
|
||||
|
||||
Logger.cleanup(delete_debug_file=True)
|
||||
Logger.cleanup()
|
||||
assert not os.path.isfile(Logger._DEBUG_LOGGER_FILE.name)
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
|
|
|||
Loading…
Reference in a new issue