forked from mrotaru/cache-bust
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.js
More file actions
executable file
·31 lines (27 loc) · 786 Bytes
/
cli.js
File metadata and controls
executable file
·31 lines (27 loc) · 786 Bytes
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
#!/usr/bin/env node
'use strict'
let args = require('minimist')(process.argv.slice(2))
let cacheBust = require('./index.js')
/**
* Parse command line arguments, set defaults
*/
if (!args['referenced'] || !args['referencing']) {
console.error('`referenced` and `referencing` options must be specified')
process.exit(1)
}
let getOpt = (long, short, defaultValue) => {
if (args.hasOwnProperty(long)) {
return args[long]
} else if (args.hasOwnProperty(short)) {
return args[short]
}
return defaultValue
}
let options = {
referenced: getOpt('referenced', 'r', ''),
referencing: getOpt('referencing', 'R', ''),
baseDir: getOpt('baseDir', 'b', process.cwd()),
hexLength: getOpt('hexLength', 'l', 7),
exclude: getOpt('exclude', 'e', [])
}
cacheBust(options)