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 | const { autoExit } = require('../lib/unref-timeout');
|
11 |
|
12 | program
|
13 | .name('fun config')
|
14 | .description('Configure the fun.')
|
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/config').send();
|
27 |
|
28 | require('../lib/commands/config')()
|
29 | .then(() => {
|
30 | visitor.event({
|
31 | ec: 'config',
|
32 | ea: 'config',
|
33 | el: 'success',
|
34 | dp: '/fun/config'
|
35 | }).send();
|
36 |
|
37 | autoExit();
|
38 | })
|
39 | .catch(error => {
|
40 | visitor.event({
|
41 | ec: 'config',
|
42 | ea: 'config',
|
43 | el: 'error',
|
44 | dp: '/fun/config'
|
45 | }).send();
|
46 |
|
47 | require('../lib/exception-handler')(error);
|
48 | });
|
49 | });
|
50 |
|
51 |
|