From 98a3295e097d65f1e864e38ecac5a012a3717666 Mon Sep 17 00:00:00 2001 From: at15 Date: Sun, 11 Sep 2016 22:46:40 -0700 Subject: [PATCH] [cli] Show available commands in help - use es6 string template literals #1 --- lib/cli/command.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/cli/command.js b/lib/cli/command.js index 9bc27a0..57188b8 100644 --- a/lib/cli/command.js +++ b/lib/cli/command.js @@ -132,12 +132,12 @@ class Command { // default value _.forEach(this.supportedFlags, (flag, name)=> { - if(!_.has(newFlags, name)){ + if (!_.has(newFlags, name)) { newFlags[name] = flag.defaultValue; } }); _.forEach(this.supportedGlobalFlags, (flag, name)=> { - if(!_.has(newFlags, name)){ + if (!_.has(newFlags, name)) { newFlags[name] = flag.defaultValue; } }); @@ -164,7 +164,10 @@ Usage: Not supported Available Commands: - Not supported + ${_.map(this.subCommands, (cmd)=> { + // pad the command name for better output + return `${_.padEnd(cmd.name, 10)} ${cmd.description}`; + }).join('\n')} Flags: Not supported