From 37219602dee2afae4bf396fbfa404154c7d1fa21 Mon Sep 17 00:00:00 2001 From: Aaron Lampros Date: Fri, 15 Apr 2016 14:00:30 -0400 Subject: [PATCH] Use H for host option short flag. Fixes subcommand help display (`-h`). Add program help text to show subcommand help. --- lib/bin/cli.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/bin/cli.js b/lib/bin/cli.js index 434f7825513d0..005e795c8aae0 100644 --- a/lib/bin/cli.js +++ b/lib/bin/cli.js @@ -22,7 +22,7 @@ program program.command('develop') .description('Start development server. Watches files and rebuilds and hot reloads if something changes') // eslint-disable-line max-len - .option('-h, --host ', + .option('-H, --host ', `Set host. Defaults to ${defaultHost}`, defaultHost ) @@ -56,7 +56,7 @@ program.command('build') program.command('serve-build') .description('Serve built site.') - .option('-h, --host ', + .option('-H, --host ', `Set host. Defaults to ${defaultHost}`, defaultHost ) @@ -78,6 +78,12 @@ program newCommand(rootPath, starter) }) +program.on('--help', () => { + console.log(`To show subcommand help: + + gatsby [command] -h +`) +}) // If the user types an unknown sub-command, just display the help. const subCmd = process.argv.slice(2, 3)[0]