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