-
Notifications
You must be signed in to change notification settings - Fork 4
/
cli.js
executable file
·42 lines (36 loc) · 1.03 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
#!/usr/bin/env node
var build = require("./index.js");
var program = require('commander');
var options = process.argv.slice(0, 2);
var command;
if (process.argv.length > 2 && process.argv[2].startsWith("-")) {
for (var i = 2; i < process.argv.length && process.argv[i] !== "--"; i++) {
options.push(process.argv[i]);
}
command = process.argv.slice(i + 1);
} else {
command = process.argv.slice(2);
}
program
.version(require("./package.json").version)
.usage("[options --] <command...>")
.arguments("<command...>")
.option("--electron <version>", "Electron version")
.option("--arch <arch>", "target architecture")
.option("--disturl <url>", "Electron headers URL")
.option("--devdir <path>", "Electron headers cache directory")
.parse(options);
if (command.length === 0) {
program.help();
}
build(command, {
electron: program.electron,
arch: program.arch,
disturl: program.disturl,
devdir: program.devdir
}, (err) => {
if (err) {
console.error(err.message);
process.exit(1);
}
});