diff --git a/schemachange/config/get_merged_config.py b/schemachange/config/get_merged_config.py index 550d3b3..8ddfde6 100644 --- a/schemachange/config/get_merged_config.py +++ b/schemachange/config/get_merged_config.py @@ -1,6 +1,7 @@ import logging import sys from argparse import Namespace +from enum import Enum from pathlib import Path from typing import Union, Optional @@ -63,6 +64,13 @@ def get_yaml_config( def get_merged_config() -> Union[DeployConfig, RenderConfig]: args = parse_cli_args(sys.argv[1:]) + if ( + "log_level" in args + and args.log_level is not None + and isinstance(args.log_level, Enum) + ): + args.log_level = args.log_level.value + cli_config = config_factory(args=args) yaml_config = get_yaml_config( subcommand=cli_config.subcommand, diff --git a/tests/test_main.py b/tests/test_main.py index f17ce10..398ec67 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -185,6 +185,22 @@ }, None, ), + ( + "schemachange.cli.deploy", + [ + "schemachange", + "deploy", + *required_args, + "--log-level", + "INFO", + ], + { + **default_deploy_config, + **required_config, + "log_level": 20, + }, + None, + ), ( "schemachange.cli.render", [