better stuff
This commit is contained in:
parent
a523a42e6e
commit
c89f96ce8a
5 changed files with 41 additions and 12 deletions
|
|
@ -1,19 +1,34 @@
|
|||
if(ARGV.length == 1) {
|
||||
console.log("Type '" + ARGV[0] + " --help' for help");
|
||||
process.exit(1);
|
||||
}
|
||||
const PADDING = 16;
|
||||
var action;
|
||||
|
||||
for(var i = 1; i < ARGV.length; i++) {
|
||||
if(ARGV[i] == "--help") {
|
||||
var keys;
|
||||
|
||||
console.log("PMake " + pmake.VERSION + " - Pyrite's build script generator");
|
||||
console.log("");
|
||||
console.log("Usage: " + ARGV[0] + " [options] action [arguments]");
|
||||
console.log("");
|
||||
console.log("ACTIONS");
|
||||
|
||||
keys = Object.keys(pmake.actions);
|
||||
for(var i = 0; i < keys.length; i++) {
|
||||
console.log(" " + keys[i] + " ".repeat(PADDING - keys[i].length) + pmake.actions[keys[i]].description);
|
||||
}
|
||||
process.exit(0);
|
||||
} else if(ARGV[i].startsWith("--")) {
|
||||
console.log("Error: invalid option '" + ARGV[i].substr(2) + "'");
|
||||
process.exit(1);
|
||||
} else if(pmake.actions[ARGV[i]]) {
|
||||
action = ARGV[i];
|
||||
break;
|
||||
} else {
|
||||
console.log("Error: no such action '" + ARGV[i] + "'");
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if(!action) {
|
||||
console.log("Type '" + ARGV[0] + " --help' for help");
|
||||
process.exit(1);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue