UNPKG

1.59 kBPlain TextView Raw
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
10const program = require('commander'),
11 pkg = require('../package'),
12 done = require('../lib/done'),
13 apemanInfr = require('../lib');
14
15program
16 .version(pkg['version'])
17 .usage('[options] [name...] ')
18 .description("Setup infra.")
19 .option('-v, --verbose', "Show verbose logs")
20 .option('-f, --force', "Force to remove image.")
21 .option('-r, --rebuild', "Delete and build infra again.")
22 .option('-d, --delete', "Remove image.")
23 .option('-c, --configuration <configuration>', "Pathname of Apemanfile")
24 .option('-l, --list', "List available watches")
25;
26
27
28//=========================
29// Show examples
30//=========================
31 program.on('--help', () => {
32 console.log(' Examples:');
33 console.log('');
34 console.log(' $ apeman-infr # Build all infra defined in $infrs prop.');
35 console.log(' $ apeman-infr -l # List available infra.');
36 console.log(' $ apeman-infr "node*" # Build infra which match pattern.');
37 console.log(' $ apeman-infr -d # Remove all infra defined in $infrs prop.');
38 console.log('');
39});
40
41program.parse(process.argv);
42
43
44//=========================
45// Run main command
46//=========================
47
48apemanInfr.apply(apemanInfr, program.args.concat({
49 verbose: program.verbose,
50 force: program.force,
51 rebuild: program.rebuild,
52 delete: program.delete,
53 configuration: program.configuration,
54 list: program.list
55}).concat(done));