From 6f7edca03dd1b44340bdf093e34ef27b9e0711bc Mon Sep 17 00:00:00 2001 From: about-code Date: Mon, 16 Sep 2019 00:05:52 +0200 Subject: [PATCH] v1.1.0 --- bin/index.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/bin/index.js b/bin/index.js index c971704f..6f1a19ba 100644 --- a/bin/index.js +++ b/bin/index.js @@ -17,25 +17,25 @@ console.log( `) // CLI -const cliOpts = buildOpts( - Object.assign( - { - "config": { type: "string", alias: "c", default: "" }, - "help": { type: "boolean", alias: "h", default: false} - }, - confSchema - ) +const parameters = Object.assign( + { + "config": { type: "string", alias: "c", default: "" , description: "Path to config file, e.g. './glossarify-md.conf.json'."}, + "help": { type: "boolean", alias: "h", default: false, description: "Show this help."} + }, + confSchema ); +const cliOpts = buildOpts(parameters); const args = minimist(proc.argv.slice(2), cliOpts); -if (args.help) { - console.log("Options:\n\n", +if (args.help || proc.argv.length === 2) { + console.log("Options:\n"); + console.log( Object - .keys(confSchema) + .keys(parameters) .filter(key => key !== "dev") .map(key => { - const {alias, type, description, default:_default} = confSchema[key]; - return `--${alias} --${key} (${type})\n${description}\nDefault: ${JSON.stringify(_default)}\n\n`; + const {alias, type, description, default:_default} = parameters[key]; + return `--${key}, --${alias} (${type})\n ${description}\n Default: ${JSON.stringify(_default)}\n\n`; }) .join("") );