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