Browse Source

Merge branch 'master' of github.com:zeithq/now into add/now-rm

master
Tony Kovanen 9 years ago
parent
commit
18825653b3
  1. 17
      bin/now
  2. 3
      bin/now-deploy
  3. 18
      bin/now-list

17
bin/now

@ -18,18 +18,25 @@ const exit = (code) => {
setTimeout(() => process.exit(code), 1000); setTimeout(() => process.exit(code), 1000);
}; };
const commands = new Set(['deploy', 'list', 'ls', 'rm', 'remove']); const defaultCommand = 'deploy';
const commands = new Set([defaultCommand, 'list', 'ls', 'rm', 'remove']);
const aliases = new Map([['ls', 'list'], ['rm', 'remove']]); const aliases = new Map([['ls', 'list'], ['rm', 'remove']]);
let cmd = argv._[0]; 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)) { 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);

3
bin/now-deploy

@ -24,6 +24,9 @@ const help = () => {
ls alias of list ls alias of list
rm remove a deployment by deployment id rm remove a deployment by deployment id
remove alias of rm remove alias of rm
help [cmd] display help for [cmd]
list [app] output list of instances
ls [app] alias of list
Options: Options:

18
bin/now-list

@ -11,6 +11,24 @@ import * as cfg from '../lib/cfg';
import { handleError, error } from '../lib/error'; import { handleError, error } from '../lib/error';
const argv = minimist(process.argv.slice(2)); 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]; const app = argv._[0];
// options // options

Loading…
Cancel
Save