diff --git a/workbench b/workbench index 6d52f17..5021222 100755 --- a/workbench +++ b/workbench @@ -15,6 +15,8 @@ import collections import subprocess import requests_cache from progress_bar import InitBar +from rich.console import Console +from rich.table import Table from ruamel.yaml import YAML from workbench_utils import * import workbench_fields @@ -3467,11 +3469,32 @@ parser.add_argument( parser.add_argument( "--contactsheet", help="Generate a contact sheet.", action="store_true" ) +parser.add_argument( + "--print_config", + help="Prints out the current configuration settings.", + action="store_true", +) parser.add_argument( "--skip_user_prompts", help='Include to skip any user prompts defined in your config file\'s "user_prompts" setting.', action="store_true", ) +parser.add_argument( + "--input_csv", + help="Overrides the 'input_csv' configuration setting.", +) +parser.add_argument( + "--input_dir", + help="Overrides the 'input_dir' configuration setting.", +) +parser.add_argument( + "--google_sheets_gid", + help="Overrides the 'google_sheets_gid' configuration setting.", +) +parser.add_argument( + "--log_file_path", + help="Overrides the 'log_file_path' configuration setting.", +) parser.add_argument("--version", action="version", version="Islandora Workbench 0.0.0") args = parser.parse_args() @@ -3491,6 +3514,30 @@ except Exception as e: sys.exit(str(e)) config = workbench_config.get_config() +if args.input_csv is not None: + config["input_csv"] = args.input_csv +if args.input_csv is not None: + config["google_sheets_gid"] = args.google_sheets_gid +if args.input_dir is not None: + config["input_dir"] = args.input_dir +if args.log_file_path is not None: + config["log_file_path"] = args.log_file_path + +if args.print_config is True: + print("\nCurrent Islandora Workbench configuration, including defaults") + table = Table() + table.add_column("Config setting", justify="left") + table.add_column("Value", justify="left") + for key, value in config.items(): + if key == "password": + table.add_row(key, "xxxxxxxxxx") + else: + table.add_row(key, str(value)) + + console = Console() + console.print(table) + sys.exit() + if args.check is not True and config["remind_user_to_run_check"] is True: if args.skip_user_prompts is not True: user_has_run_check = input("Have you run --check? (y/n)")