-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathindex.js
executable file
·62 lines (53 loc) · 1.13 KB
/
index.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
var actions = require('./lib/actions');
var inquirer = require('inquirer');
var promptFor = require('./lib/prompts');
var args = require('minimist')(process.argv.slice(2), {
alias: {
h: 'help',
g: 'generate',
f: ['file', 'filename', 'file-name'],
l: 'license',
n: ['noprompt', 'no-prompt'],
p: 'path',
s: 'show',
v: 'version',
u: ['user', 'username', 'user-name'],
y: 'year'
},
default: {
license: 'mit',
filename: 'LICENSE',
noprompt: true,
path: process.cwd(),
user: process.env.LICE_USER,
year: new Date().getFullYear()
},
boolean: [
'generate',
'noprompt',
'show'
],
string: [
'license',
'name',
'path'
]
});
if (args.license)
args.license = args.license.toLowerCase();
if (args.help)
return actions.help();
if (args.version)
return actions.version();
if (args.show && args.generate) {
actions.show(args);
return actions.generate(args);
}
if (args.show)
return actions.show(args);
if (args.generate)
return actions.generate(args);
// no action flag provided
args.noprompt = false;
promptFor.action(args);