diff --git a/README.md b/README.md index 6fff2c8..1bce78a 100644 --- a/README.md +++ b/README.md @@ -117,9 +117,15 @@ Options: Provide the hostname to serve the server (default: "0.0.0.0") * `--template ` Provide the html template for the applets (default: "./applet_template.html") + * `--basepath ` + env: **BASEPATH** + specify the basepath for all APIs (default: "") * `-D, --debug` env: **DEBUG** debug (default: false) + * `-v, --version` + show version number + **[🔝 back to top](#toc)** diff --git a/src/cli.ts b/src/cli.ts index e7388f4..af26dba 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -81,7 +81,9 @@ program .default('0.0.0.0') .argParser((h) => { if (h.includes('/')) { - L.error(`${bad} ${h} is not a valid hostname, subpath should be specified using --basepath option`); + L.error( + `${bad} ${h} is not a valid hostname, subpath should be specified using --basepath option` + ); process.exit(0); } return h; @@ -93,21 +95,22 @@ program ) ) .addOption(new Option('-D, --debug', 'debug').env('DEBUG').default(false).argParser(Boolean)) - .addOption(new Option('--basepath ', 'specify the basepath for all APIs') - .env('BASEPATH') - .default('') - .argParser((b) => { - if ( b === '') return b; - if (!b.startsWith('/')) { - L.error(`${bad} ${b} is not a valid subpath, should start with a '/'`); - process.exit(0); - } - if(b.endsWith('/')) { - L.error(`${bad} ${b} is not a valid subpath, should not end with a '/'`); - process.exit(0); - } - return b; - }) + .addOption( + new Option('--basepath ', 'specify the basepath for all APIs') + .env('BASEPATH') + .default('') + .argParser((b) => { + if (b === '') return b; + if (!b.startsWith('/')) { + L.error(`${bad} ${b} is not a valid subpath, should start with a '/'`); + process.exit(0); + } + if (b.endsWith('/')) { + L.error(`${bad} ${b} is not a valid subpath, should not end with a '/'`); + process.exit(0); + } + return b; + }) ) .version(data.version, '-v, --version') .addHelpText(