From 6118b2f137b2239a24bb4a5544f031af7e94a2ed Mon Sep 17 00:00:00 2001 From: Allison Thackston Date: Mon, 16 Mar 2026 13:14:12 -0700 Subject: [PATCH] Add a verbose flag to the generator to print the output config --- docker/deploy.sh | 2 +- mkdocs_simple_plugin/generator.py | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/docker/deploy.sh b/docker/deploy.sh index f8c4c4b55..fe7c603fd 100755 --- a/docker/deploy.sh +++ b/docker/deploy.sh @@ -18,7 +18,7 @@ echo "config: ${INPUT_CONFIG}" INPUT_PUSH=${INPUT_PUSH:-"true"} echo "push: ${INPUT_PUSH}" -mkdocs_simple_gen --config-file ${INPUT_CONFIG} +mkdocs_simple_gen --config-file ${INPUT_CONFIG} --verbose if [[ "${INPUT_PUSH}" == "1" || "${INPUT_PUSH,,}" == "true" ]]; then git config --global user.name "${GITHUB_ACTOR}" diff --git a/mkdocs_simple_plugin/generator.py b/mkdocs_simple_plugin/generator.py index eaf2e32db..be2464b33 100644 --- a/mkdocs_simple_plugin/generator.py +++ b/mkdocs_simple_plugin/generator.py @@ -138,14 +138,24 @@ def setup_config(config_file="mkdocs.yml"): @click.command() @click.option("--config-file", default="mkdocs.yml", help="Set the configuration file.") +@click.option("-v", "--verbose", is_flag=True, + help="Print the final configuration file.") @click.option('--build/--no-build', default=False, help="Build the site using mkdocs build.") @click.option('--serve/--no-serve', default=False, help="Serve the site using mkdocs serve.") @click.argument('mkdocs-args', nargs=-1) -def main(config_file, build, serve, mkdocs_args): +def main(config_file, verbose, build, serve, mkdocs_args): """Generate and build a mkdocs site.""" - setup_config(config_file) + config = setup_config(config_file) + if verbose: + click.echo(yaml.dump( + data=config, + sort_keys=False, + default_flow_style=False, + Dumper=MkdocsConfigDumper + ).rstrip()) + args = mkdocs_args + ("-f", config_file) if build: os.system("mkdocs build " + " ".join(args))