-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathcli.js
92 lines (69 loc) · 1.71 KB
/
cli.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/env node
'use strict'
const argv = require('rasper')(process.argv.slice(2))
const pkg = require('./package.json')
const banner = require('./')
let options = {}
if (argv.v || argv.version) {
console.log(pkg.version)
process.exit(0)
}
if (argv.h || argv.help) {
console.log(`
Usage:
$ banner-cli <files> [<options>]
Options:
-n, --name Define project name
-t, --tag Define tag version
-s, --site Define homepage
-a, --author Define author
-y, --year Define year
-l, --license Define license
-h, --help Display help information
-v, --version Output version
Examples:
$ banner-cli dist/**/*.js
$ banner-cli dist/**/*.css --author 'CJ Patoilo' --license MIT --site https://milligram.io
`)
process.exit(0)
}
if (argv.n && argv.n !== true) {
options.name = argv.n
}
if (argv.name && argv.name !== true) {
options.name = argv.name
}
if (argv.t && argv.t !== true) {
options.tag = argv.t
}
if (argv.tag && argv.tag !== true) {
options.tag = argv.tag
}
if (argv.s && argv.s !== true) {
options.homepage = argv.s
}
if (argv.site && argv.site !== true) {
options.homepage = argv.site
}
if (argv.l && argv.l !== true) {
options.license = argv.l
}
if (argv.license && argv.license !== true) {
options.license = argv.license
}
if (argv.a && argv.a !== true) {
options.author = argv.a
}
if (argv.author && argv.author !== true) {
options.author = argv.author
}
if (argv.year && argv.year !== true) {
options.year = argv.year
}
if (argv.y && argv.y !== true) {
options.year = argv.y
}
if (argv._[0]) {
options.source = argv._[0]
banner(options)
}