-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.js
64 lines (53 loc) · 1.45 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#! /usr/bin/env node
'use strict';
const fs = require('fs'),
colors = require("colors"),
inquirer = require('inquirer'),
argv = require( 'argv' ),
logger = require('./lib/sys/resultLogger');
//Import app modules
const addComponent = require('./lib/util/addComponent'),
addPage = require('./lib/util/addPage');
const setupOpts = () => {
argv.option({
name: 'template',
short: 't',
type: 'string',
description: 'Defines an option for your script',
example: "'ojet-comp --template=navdrawer' or 'script -t navdrawer'"
});
};
/**
*
*/
const parseArgs = () => {
//setupOpts()
argv.info(
` Oracle Jet Comp - Alex Wiley
---
Available commands:
- page
- component
Options:
`);
let command = argv.run().targets[0] ;
let opts = argv.run().options;
switch (command){
case 'component':
addComponent.init();
break;
case 'page':
addPage.init();
break;
default:
let msg;
if(!command){
msg = `You must provide a command to the program. Type ojet-comp -h to get assistance.`;
}
else{
msg = `[ERROR]: ${command} is not a command. Please try again or type ojet-comp -h for assistance.`;
}
logger(colors.red(msg), "both", true);
}
};
module.exports = parseArgs();