diff --git a/bin/now b/bin/now index ed777ff..9c811b6 100755 --- a/bin/now +++ b/bin/now @@ -18,18 +18,25 @@ const exit = (code) => { setTimeout(() => process.exit(code), 1000); }; -const commands = new Set(['deploy', 'list', 'ls']); +const defaultCommand = 'deploy'; +const commands = new Set([defaultCommand, 'list', 'ls']); const aliases = new Map([['ls', 'list']]); let cmd = argv._[0]; -let args; +let args = []; + +if ('help' === cmd) { + cmd = argv._[1]; + if (!commands.has(cmd)) cmd = defaultCommand; + args.push('--help'); +} if (commands.has(cmd)) { cmd = aliases.get(cmd) || cmd; - args = process.argv.slice(3); + args = args.concat(process.argv.slice(3)); } else { - cmd = 'deploy'; - args = process.argv.slice(2); + cmd = defaultCommand; + args = args.concat(process.argv.slice(2)); } const bin = resolve(__dirname, 'now-' + cmd); diff --git a/bin/now-deploy b/bin/now-deploy index e96743b..e2e282c 100755 --- a/bin/now-deploy +++ b/bin/now-deploy @@ -20,8 +20,9 @@ const help = () => { Commands: - list output list of instances - ls alias of list + list [app] output list of instances + ls [app] alias of list + help [cmd] display help for [cmd] Options: diff --git a/bin/now-list b/bin/now-list index e724fd6..019f65a 100755 --- a/bin/now-list +++ b/bin/now-list @@ -11,6 +11,24 @@ import * as cfg from '../lib/cfg'; import { handleError, error } from '../lib/error'; const argv = minimist(process.argv.slice(2)); +const help = () => { + console.log(` + 𝚫 now list [app] + + Alias: ls + + Options: + + -h, --help output usage information + -d, --debug Debug mode [off] +`); +}; + +if (argv.h || argv.help) { + help(); + process.exit(0); +} + const app = argv._[0]; // options