Shorten --config-file option

Now is `--config`
pull/5/head
Robert Dailey 3 years ago
parent 3aad617219
commit dc5ef2b25a

@ -28,7 +28,7 @@ def setup_and_parse_args(args_override=None):
action='store_true')
parent_p.add_argument('--debug', help='Display additional logs useful for development/debug purposes',
action='store_true')
parent_p.add_argument('--config-file', help='The configuration YAML file to use. If not specified, the script will look for `trash.yml` in the same directory as the `trash.py` script.')
parent_p.add_argument('--config', help='The configuration YAML file to use. If not specified, the script will look for `trash.yml` in the same directory as the `trash.py` script.')
parser = argparse.ArgumentParser(description='Automatically mirror TRaSH guides to your Sonarr/Radarr instance.')
subparsers = parser.add_subparsers(description='Operations specific to different parts of the TRaSH guides', dest='subcommand')

@ -10,8 +10,8 @@ def find_profile_by_name(config, profile_type):
# --------------------------------------------------------------------------------------------------
def load_config(args, logger, default_load_path: Path):
if args.config_file:
config_path = Path(args.config_file)
if args.config:
config_path = Path(args.config)
else:
# Look for `trash.yml` in the same directory as the main (entrypoint) python script.
config_path = default_load_path / 'trash.yml'

@ -20,7 +20,7 @@ def test_config_load_from_file_args(mocker):
mocker.patch.object(Path, 'exists', return_value=True)
expected_yml_path = Path(__file__).parent.parent / 'overridden_config.yml'
args = cmd.setup_and_parse_args(['profile', 'sonarr:anime', '--config-file', str(expected_yml_path)])
args = cmd.setup_and_parse_args(['profile', 'sonarr:anime', '--config', str(expected_yml_path)])
config.load_config(args, MockLogger(), '.')
mock_open.assert_called_once_with(expected_yml_path, 'r')

Loading…
Cancel
Save