(argv)
| 123 | |
| 124 | export default class extends TOOL { |
| 125 | constructor(argv) { |
| 126 | super(argv); |
| 127 | this.moddablePath = this.getenv("MODDABLE"); |
| 128 | if (!this.moddablePath) |
| 129 | throw new Error("MODDABLE: variable not found!"); |
| 130 | this.moddablePath = this.resolveDirectoryPath(this.moddablePath); |
| 131 | if (!this.moddablePath) |
| 132 | throw new Error("invalid MODDABLE environment variable!"); |
| 133 | this.windows = this.currentPlatform == "win"; |
| 134 | this.slash = this.windows ? "\\" : "/"; |
| 135 | this.buildPath = this.moddablePath + this.slash + "build"; |
| 136 | this.packagePath = this.currentDirectory; |
| 137 | this.examplesPath = this.moddablePath + this.slash + "examples"; |
| 138 | this.modulesPath = this.moddablePath + this.slash + "modules"; |
| 139 | this.outputPath = null; |
| 140 | this.environment = { |
| 141 | MODDABLE:this.moddablePath, |
| 142 | MODULES:this.modulesPath, |
| 143 | COMMODETTO:this.modulesPath + this.slash + "commodetto", |
| 144 | }; |
| 145 | |
| 146 | let name, path; |
| 147 | let argc = argv.length; |
| 148 | let argi = 1; |
| 149 | for (; argi < argc; argi++) { |
| 150 | name = argv[argi]; |
| 151 | if ((name == "mcconfig") || (name == "mcrun") || (name == "list")) |
| 152 | break; |
| 153 | path = this.resolveFilePath(name); |
| 154 | if (!path) |
| 155 | throw new Error("" + name + "': package not found!"); |
| 156 | let parts = this.splitPath(path); |
| 157 | if ((parts.name != "package") || (parts.extension != ".json")) |
| 158 | throw new Error("" + name + "': invalid package name!"); |
| 159 | this.packagePath = parts.directory; |
| 160 | this.currentDirectory = this.packagePath; |
| 161 | } |
| 162 | if (name == "mcconfig") { |
| 163 | this.hasCreationMain = true; |
| 164 | } |
| 165 | else if (name == "mcrun") { |
| 166 | this.hasCreationMain = false; |
| 167 | } |
| 168 | else if (name == "list") { |
| 169 | this.hasCreationMain = undefined; |
| 170 | } |
| 171 | else { |
| 172 | throw new Error("no action!"); |
| 173 | } |
| 174 | |
| 175 | argi++; |
| 176 | this.argv = argv.slice(argi); |
| 177 | for (; argi < argc; argi++) { |
| 178 | var option = argv[argi]; |
| 179 | switch (option) { |
| 180 | case "-o": |
| 181 | argi++; |
| 182 | if (argi >= argc) |
nothing calls this directly
no test coverage detected