better
This commit is contained in:
parent
cc0105dec3
commit
4498e11516
1 changed files with 3 additions and 4 deletions
|
|
@ -47,8 +47,7 @@ for(var i = 1; i < ARGV.length; i++) {
|
|||
|
||||
if(pmake.options[args[0]]) {
|
||||
var opts = pmake.options[args[0]].options;
|
||||
|
||||
if(!opts) opts = [];
|
||||
var opt = pmake.options[args[0]].option;
|
||||
|
||||
if(opts) {
|
||||
if((typeof opts) == "function") opts = opts();
|
||||
|
|
@ -57,10 +56,10 @@ for(var i = 1; i < ARGV.length; i++) {
|
|||
if(opts && !args[1]) {
|
||||
console.log("Error: no value specified for option '" + args[0] + "'");
|
||||
process.exit(1);
|
||||
} else if(opts.length > 0 && !opts.includes(args[1])) {
|
||||
} else if(opts && !opts.includes(args[1])) {
|
||||
console.log("Error: invalid value '" + args[1] + "' for option '" + args[0] + "'");
|
||||
process.exit(1);
|
||||
} else if(opts) {
|
||||
} else if(opts || opt) {
|
||||
pmake.options[args[0]].action(args[1]);
|
||||
} else {
|
||||
pmake.options[args[0]].action();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue