mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-12-14 05:45:20 +01:00
[Dev] eggMoves:parse CLI script no longer errors without args/on exit (#6788)
* [Dev] `eggMoves:parse` script no longer crashes without args, errors on exit no more 1 exit code or undefined errors * Version bump * comment fixes --------- Co-authored-by: Wlowscha <54003515+Wlowscha@users.noreply.github.com>
This commit is contained in:
parent
3478e09923
commit
c6986d9cf5
@ -1,3 +1,9 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024-2025 Pagefault Games
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
//! DO NOT EDIT THIS FILE - CREATED BY THE `eggMoves:parse` script automatically
|
||||
import { MoveId } from "#enums/move-id";
|
||||
import { SpeciesId } from "#enums/species-id";
|
||||
|
||||
@ -1,4 +0,0 @@
|
||||
SPDX-FileCopyrightText: 2025 Pagefault Games
|
||||
SPDX-FileContributor: Bertie690
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only
|
||||
@ -32,7 +32,7 @@ export async function runInteractive() {
|
||||
|
||||
if (answer === "Exit") {
|
||||
console.log("Exiting...");
|
||||
process.exitCode = 1;
|
||||
process.exitCode = 0;
|
||||
return { type: "Exit" };
|
||||
}
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ import { showHelpText } from "./help-message.js";
|
||||
import { runInteractive } from "./interactive.js";
|
||||
import { parseEggMoves } from "./parse.js";
|
||||
|
||||
const version = "1.0.0";
|
||||
const version = "1.0.1";
|
||||
|
||||
// Get the directory name of the current module file
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
@ -54,8 +54,8 @@ async function start() {
|
||||
|
||||
let csv = "";
|
||||
const inputType = await parseArguments();
|
||||
if (process.exitCode) {
|
||||
// If exit code is non-zero, return to allow it to propagate up the chain.
|
||||
// If exit code was set, return to allow it to propagate it up the chain.
|
||||
if (process.exitCode != null) {
|
||||
return;
|
||||
}
|
||||
switch (inputType.type) {
|
||||
@ -66,7 +66,6 @@ async function start() {
|
||||
csv = await fs.promises.readFile(inputType.value, "utf-8");
|
||||
break;
|
||||
case "Exit":
|
||||
// Help screen triggered; break out
|
||||
return;
|
||||
}
|
||||
|
||||
@ -80,8 +79,10 @@ async function start() {
|
||||
async function parseArguments() {
|
||||
const args = process.argv.slice(2); // first 2 args are node and script name (irrelevant)
|
||||
|
||||
// Yoink everything up to the first "=" to get the raw command, using nullish coaclescing to convert
|
||||
// "no args" into "undefined"
|
||||
/** @type {string | undefined} */
|
||||
const arg = args[0].split("=")[0]; // Yoink everything up to the first "=" to get the raw command
|
||||
const arg = args[0]?.split("=")[0];
|
||||
switch (arg) {
|
||||
case "-f":
|
||||
case "--file":
|
||||
|
||||
@ -1,3 +1,9 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2024-2025 Pagefault Games
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
//! DO NOT EDIT THIS FILE - CREATED BY THE `eggMoves:parse` script automatically
|
||||
import { MoveId } from "#enums/move-id";
|
||||
import { SpeciesId } from "#enums/species-id";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user