1 | #!/usr/bin/env node
|
2 |
|
3 | /**
|
4 | * Command line interface of apeman-dply.
|
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 | apemanDply = require('../lib');
|
14 |
|
15 | program
|
16 | .version(pkg['version'])
|
17 | .usage('[options] [name...] ')
|
18 | .description("Deploy project on docker.")
|
19 | .option('-v, --verbose', "Show verbose logs")
|
20 | .option('-f, --force', "Force to remove container.")
|
21 | .option('-d, --delete', "Remove container.")
|
22 | .option('-c, --configuration <configuration>', "Pathname of Apemanfile")
|
23 | .option('-l, --list', "List available watches")
|
24 | .option('-t, --tty', "Open terminal for dply")
|
25 | .option('-r, --rerun', "Delete and execute deploying again.")
|
26 | .option('-e, --exec <exec>', "Execute a command inside container.")
|
27 | .option('-p, --print', "Print container log.")
|
28 | .option('-P, --printon', "Print and follow container log.")
|
29 | ;
|
30 |
|
31 |
|
32 | //=========================
|
33 | // Show examples
|
34 | //=========================
|
35 | program.on('--help', () => {
|
36 | console.log(' Examples:');
|
37 | console.log('');
|
38 | console.log(' $ apeman-dply # Execute deploying defined in $dplys prop.');
|
39 | console.log(' $ apeman-dply -l # List available deploy.');
|
40 | console.log(' $ apeman-dply -t node # Open terminal for a deploy.');
|
41 | console.log(' $ apeman-dply "node*" # Execute deploy which match pattern.');
|
42 | console.log(' $ apeman-dply -d # Remove all deploy defined in $infra prop.');
|
43 | console.log('');
|
44 | });
|
45 |
|
46 | program.parse(process.argv);
|
47 |
|
48 |
|
49 | //=========================
|
50 | // Run main command
|
51 | //=========================
|
52 |
|
53 | apemanDply.apply(apemanDply, program.args.concat({
|
54 | verbose: program.verbose,
|
55 | force: program.force,
|
56 | delete: program.delete,
|
57 | configuration: program.configuration,
|
58 | list: program.list,
|
59 | tty: program.tty,
|
60 | rerun: program.rerun,
|
61 | exec: program.exec,
|
62 | print: program.print,
|
63 | printon: program.printon
|
64 | }).concat(done));
|