UNPKG

959 BJavaScriptView Raw
1#!/usr/bin/env node
2import * as route from './route'
3import * as utils from './utils'
4import pkg from './package.json'
5
6require('subcmd')({
7 name : 'zombie-swarm',
8 usage : `Usage: zombie-swarm [COMMAND] [OPTIONS]
9
10COMMAND(s)
11
12 ls - list swarm nodes
13 plan - create a plan
14 apply - apply a plan
15 services - list swarm services
16
17OPTIONS
18`,
19 options : utils.defaultOptions.concat([
20 {
21 name: 'version',
22 abbr: 'v',
23 help: 'Prints version'
24 }
25 ]),
26 command : function(args, cliclopts) {
27 if (args.v) return console.log(pkg.version)
28 console.log(cliclopts.usage())
29 },
30 commands : [
31 require('./sub-commands/ls').default,
32 require('./sub-commands/plan').default,
33 require('./sub-commands/apply').default,
34 require('./sub-commands/services').default
35 ]
36},{
37 autoHelp : true
38})(process.argv.slice(2))
39
40// TODO: Improve err output if no node with required tag found!