1 | #!/usr/bin/env node
|
2 |
|
3 | /**
|
4 | * Command line interface of apeman-infr.
|
5 | * This file is auto generated by ape-tmpl.
|
6 | */
|
7 |
|
8 | "use strict";
|
9 |
|
10 | const program = require('commander'),
|
11 | pkg = require('../package'),
|
12 | done = require('../lib/done'),
|
13 | apemanInfr = require('../lib');
|
14 |
|
15 | program
|
16 | .version(pkg['version'])
|
17 | .usage('[options] [name...] ')
|
18 | .description(pkg['description'])
|
19 | .option('-v, --verbose', "Show verbose logs")
|
20 | .option('-f, --force', "Force to remove image.")
|
21 | .option('-d, --delete', "Remove image.")
|
22 | .option('-c, --configuration <configuration>', "Pathname of Apemanfile")
|
23 | .option('-l, --list', "List available watches")
|
24 | ;
|
25 |
|
26 |
|
27 | //=========================
|
28 | // Show examples
|
29 | //=========================
|
30 | program.on('--help', () => {
|
31 | console.log(' Examples:');
|
32 | console.log('');
|
33 | console.log(' $ apeman-infr # Build all infra defined in $infrs prop.');
|
34 | console.log(' $ apeman-infr -l # List available infra.');
|
35 | console.log(' $ apeman-infr "node*" # Build infra which match pattern.');
|
36 | console.log(' $ apeman-infr -d # Remove all infra defined in $infrs prop.');
|
37 | console.log('');
|
38 | });
|
39 |
|
40 | program.parse(process.argv);
|
41 |
|
42 |
|
43 | //=========================
|
44 | // Run main command
|
45 | //=========================
|
46 |
|
47 | apemanInfr.apply(apemanInfr, program.args.concat({
|
48 | verbose: program.verbose,
|
49 | force: program.force,
|
50 | delete: program.delete,
|
51 | configuration: program.configuration,
|
52 | list: program.list
|
53 | }).concat(done));
|