UNPKG

1.03 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 init')
13 .description('For each service with NAS config, create local NAS folder and deploy fun nas server service.')
14 .parse(process.argv);
15
16if (program.args.length) {
17 console.error();
18 console.error(" error: unexpected argument '%s'", program.args[0]);
19 program.help();
20}
21
22notifier.notify();
23
24getVisitor(true).then((visitor) => {
25 visitor.pageview('/fun/nas/init').send();
26
27 require('../lib/commands/nas/init')()
28 .then(() => {
29 visitor.event({
30 ec: 'init',
31 ea: 'init',
32 el: 'success',
33 dp: '/fun/nas/init'
34 }).send();
35 })
36 .catch(error => {
37 visitor.event({
38 ec: 'init',
39 ea: 'init',
40 el: 'error',
41 dp: '/fun/nas/init'
42 }).send();
43
44 require('../lib/exception-handler')(error);
45 });
46});