2026-05-08 19:07:45 +09:00
|
|
|
const PADDING = 16;
|
|
|
|
|
var action;
|
2026-05-08 05:18:35 +09:00
|
|
|
|
2026-05-08 05:35:07 +09:00
|
|
|
for(var i = 1; i < ARGV.length; i++) {
|
|
|
|
|
if(ARGV[i] == "--help") {
|
2026-05-08 19:07:45 +09:00
|
|
|
var keys;
|
|
|
|
|
|
2026-05-08 05:18:35 +09:00
|
|
|
console.log("PMake " + pmake.VERSION + " - Pyrite's build script generator");
|
|
|
|
|
console.log("");
|
|
|
|
|
console.log("Usage: " + ARGV[0] + " [options] action [arguments]");
|
2026-05-08 19:07:45 +09:00
|
|
|
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);
|
|
|
|
|
}
|
2026-05-08 05:18:35 +09:00
|
|
|
process.exit(0);
|
2026-05-08 05:35:07 +09:00
|
|
|
} else if(ARGV[i].startsWith("--")) {
|
2026-05-08 05:25:34 +09:00
|
|
|
console.log("Error: invalid option '" + ARGV[i].substr(2) + "'");
|
|
|
|
|
process.exit(1);
|
2026-05-08 19:07:45 +09:00
|
|
|
} else if(pmake.actions[ARGV[i]]) {
|
|
|
|
|
action = ARGV[i];
|
|
|
|
|
break;
|
2026-05-08 05:35:07 +09:00
|
|
|
} else {
|
2026-05-08 05:25:34 +09:00
|
|
|
console.log("Error: no such action '" + ARGV[i] + "'");
|
|
|
|
|
process.exit(1);
|
2026-05-08 05:18:35 +09:00
|
|
|
}
|
|
|
|
|
}
|
2026-05-08 19:07:45 +09:00
|
|
|
|
|
|
|
|
if(!action) {
|
|
|
|
|
console.log("Type '" + ARGV[0] + " --help' for help");
|
|
|
|
|
process.exit(1);
|
|
|
|
|
}
|