From c0090fd3fedc664cb33049bef5bc7e27225cb2b8 Mon Sep 17 00:00:00 2001 From: Ruben Taelman Date: Wed, 31 Jul 2019 18:44:27 +0200 Subject: [PATCH] Allow baseUrl to be overridden via CLI --- bin/generate-infobook-html.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/generate-infobook-html.ts b/bin/generate-infobook-html.ts index ccd1f6c..d0edc76 100644 --- a/bin/generate-infobook-html.ts +++ b/bin/generate-infobook-html.ts @@ -17,10 +17,10 @@ import {HtmlInfoBookSerializer, ISerializeContext} from "../lib/serialize/HtmlIn // Process CLI args const args = minimist(process.argv.slice(2)); -if (args.help || args._.length !== 2) { +if (args.help || (args._.length !== 2 && args._.length !== 3)) { process.stdout.write(`generate-cyclops-infobook-html Output Cyclops infobooks as HTML Usage: - generate-cyclops-infobook-html /path/to/config.json /path/to/output/ + generate-cyclops-infobook-html /path/to/config.json /path/to/output/ [baseUrl] Options: --help print this help message `); @@ -31,6 +31,11 @@ async function create() { // Create infobook from config const config = JSON.parse(fs.readFileSync(args._[0], "utf8")); + // Override baseUrl + if (args._.length === 3) { + config.baseUrl = args._[2]; + } + // Check if registries have been generated if (!fs.existsSync('registries')) { process.stderr.write(