Browse Source

add the help command

master
nkzawa 9 years ago
parent
commit
400a67bef9
  1. 16
      bin/now

16
bin/now

@ -18,18 +18,24 @@ const exit = (code) => {
setTimeout(() => process.exit(code), 1000); 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']]); const aliases = new Map([['ls', 'list']]);
let cmd = argv._[0]; let cmd = argv._[0];
let args; let args = [];
if ('help' === cmd) {
cmd = argv._[1] || defaultCommand;
args.push('--help');
}
if (commands.has(cmd)) { if (commands.has(cmd)) {
cmd = aliases.get(cmd) || cmd; cmd = aliases.get(cmd) || cmd;
args = process.argv.slice(3); args = args.concat(process.argv.slice(3));
} else { } else {
cmd = 'deploy'; cmd = defaultCommand;
args = process.argv.slice(2); args = args.concat(process.argv.slice(2));
} }
const bin = resolve(__dirname, 'now-' + cmd); const bin = resolve(__dirname, 'now-' + cmd);

Loading…
Cancel
Save