1 | #!/usr/bin/env node
|
2 |
|
3 | /**
|
4 | * Command line interface of apeman-srch.
|
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 | apemanSrch = require('../lib');
|
14 |
|
15 | program
|
16 | .version(pkg['version'])
|
17 | .usage('[options] [term...] ')
|
18 | .description("Search apeman modules.")
|
19 | .option('-v, --verbose', "Show verbose logs")
|
20 | .option('-t, --type <type>', "Type to search.")
|
21 | ;
|
22 |
|
23 |
|
24 | //=========================
|
25 | // Show examples
|
26 | //=========================
|
27 | program.on('--help', () => {
|
28 | console.log(' Examples:');
|
29 | console.log('');
|
30 | console.log(' $ apeman-srch # List all available packages.');
|
31 | console.log(' $ apeman-srch -t task # List all available task packages.');
|
32 | console.log(' $ apeman-srch -t task "foo" # List all available task wich match term "foo".');
|
33 | console.log('');
|
34 | });
|
35 |
|
36 | program.parse(process.argv);
|
37 |
|
38 |
|
39 | //=========================
|
40 | // Run main command
|
41 | //=========================
|
42 |
|
43 | apemanSrch.apply(apemanSrch, program.args.concat({
|
44 | verbose: program.verbose,
|
45 | type: program.type
|
46 | }).concat(done));
|