better constructor

This commit is contained in:
Nishi 2026-05-10 02:13:40 +09:00
commit 013b7321f1
Signed by: nishi
GPG key ID: 27EF69B208EB9343

View file

@ -241,7 +241,14 @@ const System = function() {};
System.prototype.init = function() {
};
const Option = function() {};
const Option = function(cmd) {
if(cmd) {
const c = cmd.split("=");
this.target = c[0];
this.option = c[1];
}
};
const Project = function(target) {
this.target = target;
@ -296,12 +303,9 @@ pmake.File = File;
/*** Option ***/
(function() {
const Compiler = new pmake.Option();
const Compiler = new pmake.Option("compiler=VALUE");
Compiler.category = "General";
Compiler.target = "compiler";
Compiler.description = "Choose a compiler set; one of:";
Compiler.option = "VALUE";
Compiler.options = function() {
return Object.keys(pmake.compilers);
@ -311,12 +315,9 @@ Compiler.action = function(value) {
pmake.setCompiler(value);
};
const System = new pmake.Option();
const System = new pmake.Option("system=VALUE");
System.category = "General";
System.target = "system";
System.description = "Generate files for a different system; one of:";
System.option = "VALUE";
System.options = function() {
return Object.keys(pmake.systems);