UNPKG

1.09 kBJavaScriptView Raw
1#!/usr/bin/env node
2
3/* eslint-disable quotes */
4
5'use strict';
6
7const program = require('commander');
8const getVisitor = require('../lib/visitor').getVisitor;
9const notifier = require('../lib/update-notifier');
10
11program
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
17if (program.args.length) {
18 console.error();
19 console.error(" error: unexpected argument '%s'", program.args[0]);
20 program.help();
21}
22
23notifier.notify();
24
25getVisitor(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