1 | #!/usr/bin/env node
|
2 |
|
3 |
|
4 |
|
5 | 'use strict';
|
6 |
|
7 | const program = require('commander');
|
8 | const getVisitor = require('../lib/visitor').getVisitor;
|
9 | const notifier = require('../lib/update-notifier');
|
10 |
|
11 | program
|
12 | .name('fun nas info')
|
13 | .description('Print nas config information, such as local temp directory of NAS.')
|
14 | .option('-t, --template [template]', 'The path of fun template file.')
|
15 | .parse(process.argv);
|
16 |
|
17 | if (program.args.length) {
|
18 | console.error();
|
19 | console.error(" error: unexpected argument '%s'", program.args[0]);
|
20 | program.help();
|
21 | }
|
22 |
|
23 | notifier.notify();
|
24 |
|
25 | getVisitor(true).then((visitor) => {
|
26 | visitor.pageview('/fun/nas/info').send();
|
27 |
|
28 | require('../lib/commands/nas/info')(program.template)
|
29 | .then(() => {
|
30 | visitor.event({
|
31 | ec: 'info',
|
32 | ea: 'info',
|
33 | el: 'success',
|
34 | dp: '/fun/nas/info'
|
35 | }).send();
|
36 | })
|
37 | .catch(error => {
|
38 | visitor.event({
|
39 | ec: 'info',
|
40 | ea: 'info',
|
41 | el: 'error',
|
42 | dp: '/fun/nas/info'
|
43 | }).send();
|
44 |
|
45 | require('../lib/exception-handler')(error);
|
46 | });
|
47 | });
|
48 |
|
49 |
|