UNPKG

1.31 kBPlain TextView Raw
1#!/usr/bin/env node
2
3/**
4 * Command line interface of apeman-task.
5 * This file is auto generated by ape-tmpl.
6 */
7
8"use strict";
9
10const program = require('commander'),
11 pkg = require('../package'),
12 apemanTask = require('../lib');
13
14program
15 .version(pkg['version'])
16 .usage('[options] [name...] ')
17 .description("Run tasks.")
18 .option('-s, --silent', "Disable console logs")
19 .option('-v, --verbose', "Show verbose logs")
20 .option('-c, --configuration <configuration>', "Pathname of Apemanfile")
21;
22
23
24//=========================
25// Show examples
26//=========================
27program.on('--help', () => {
28 console.log(' Examples:');
29 console.log('');
30 console.log(' $ apeman-task # Show all available tasks.');
31 console.log(' $ apeman-task build test # Run tasks.');
32 console.log('');
33});
34
35program.parse(process.argv);
36
37
38//=========================
39// Run main command
40//=========================
41
42apemanTask.apply(apemanTask, program.args.concat({
43 silent: program.silent,
44 verbose: program.verbose,
45 configuration: program.configuration})
46).catch(handleError);
47
48
49//=========================
50// Handlers
51//=========================
52
53/** Handle error */
54function handleError(err) {
55 console.error(err);
56 process.exit(1);
57}