Skip to content

Commit

Permalink
Merge branch 'issue_850'
Browse files Browse the repository at this point in the history
  • Loading branch information
mjordan committed Nov 19, 2024
2 parents 9b15fb4 + 72ccb97 commit 5ca5101
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions workbench
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()

Expand All @@ -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)")
Expand Down

0 comments on commit 5ca5101

Please sign in to comment.