mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-12-14 22:05:34 +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
|
//! DO NOT EDIT THIS FILE - CREATED BY THE `eggMoves:parse` script automatically
|
||||||
import { MoveId } from "#enums/move-id";
|
import { MoveId } from "#enums/move-id";
|
||||||
import { SpeciesId } from "#enums/species-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") {
|
if (answer === "Exit") {
|
||||||
console.log("Exiting...");
|
console.log("Exiting...");
|
||||||
process.exitCode = 1;
|
process.exitCode = 0;
|
||||||
return { type: "Exit" };
|
return { type: "Exit" };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,7 @@ import { showHelpText } from "./help-message.js";
|
|||||||
import { runInteractive } from "./interactive.js";
|
import { runInteractive } from "./interactive.js";
|
||||||
import { parseEggMoves } from "./parse.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
|
// Get the directory name of the current module file
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
@ -54,8 +54,8 @@ async function start() {
|
|||||||
|
|
||||||
let csv = "";
|
let csv = "";
|
||||||
const inputType = await parseArguments();
|
const inputType = await parseArguments();
|
||||||
if (process.exitCode) {
|
// If exit code was set, return to allow it to propagate it up the chain.
|
||||||
// If exit code is non-zero, return to allow it to propagate up the chain.
|
if (process.exitCode != null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
switch (inputType.type) {
|
switch (inputType.type) {
|
||||||
@ -66,7 +66,6 @@ async function start() {
|
|||||||
csv = await fs.promises.readFile(inputType.value, "utf-8");
|
csv = await fs.promises.readFile(inputType.value, "utf-8");
|
||||||
break;
|
break;
|
||||||
case "Exit":
|
case "Exit":
|
||||||
// Help screen triggered; break out
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,8 +79,10 @@ async function start() {
|
|||||||
async function parseArguments() {
|
async function parseArguments() {
|
||||||
const args = process.argv.slice(2); // first 2 args are node and script name (irrelevant)
|
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} */
|
/** @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) {
|
switch (arg) {
|
||||||
case "-f":
|
case "-f":
|
||||||
case "--file":
|
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
|
//! DO NOT EDIT THIS FILE - CREATED BY THE `eggMoves:parse` script automatically
|
||||||
import { MoveId } from "#enums/move-id";
|
import { MoveId } from "#enums/move-id";
|
||||||
import { SpeciesId } from "#enums/species-id";
|
import { SpeciesId } from "#enums/species-id";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user