From 52309db38b746f5653cee08a1e9d20008da9750c Mon Sep 17 00:00:00 2001
From: Frankly George <54015-franklygeorge@users.noreply.gitgud.io>
Date: Mon, 25 Mar 2024 15:38:22 +0000
Subject: [PATCH] Settings menu rework

---
 cspell.json               |   1 +
 devTools/scripts/setup.js | 467 ++++++++++++++++++++------------------
 2 files changed, 250 insertions(+), 218 deletions(-)

diff --git a/cspell.json b/cspell.json
index f47a083b498..a99f14fcc74 100644
--- a/cspell.json
+++ b/cspell.json
@@ -90,6 +90,7 @@
         "javascript->JavaScript",
         "non-lethal->nonlethal",
         "randomise->randomize",
+        "seperator->separator",
         "slave-owner->slaveowner",
         "slave-owners->slaveowners",
         "slave-ownership->slaveownership",
diff --git a/devTools/scripts/setup.js b/devTools/scripts/setup.js
index 1ae3eee36ad..bddee5c8f6c 100644
--- a/devTools/scripts/setup.js
+++ b/devTools/scripts/setup.js
@@ -20,6 +20,8 @@ const args = yargs(hideBin(process.argv))
 	})
 	.parse();
 
+const separatorString = "-".repeat(78);
+
 // default settings
 /**
  * @typedef {object} Settings
@@ -133,63 +135,189 @@ if (args.settings === true) {
 /** @type {Settings} */
 let originalSettings = JSON.parse(JSON.stringify(settings));
 
-let compilerMenuChoice;
-
-async function compilerSettings() {
-	let choices = [];
-	if (settings.compilerMode === "advanced") {
-		choices.push("Using the advanced compiler");
-		choices.push(settings.compileThemes
+const strings = {
+	compilerMode: () => {
+		if (settings.compilerMode === "advanced") {
+			return "Using the advanced compiler";
+		} else {
+			return "Using the simple compiler, change to the advanced compiler for more options";
+		}
+	},
+	compileThemes: () => {
+		return (settings.compileThemes
 			? "Themes are compiled"
 			: "Themes are not compiled"
 		);
-		choices.push(settings.compilerSourcemaps
+	},
+	compilerSourcemaps: () => {
+		return (settings.compilerSourcemaps
 			? "Source maps are added, minification is disabled"
 			: "Source maps are not added"
 		);
-		if (settings.compilerSourcemaps === false) {
-			choices.push(settings.compilerMinify
-				? "Build is minified"
-				: "Build is not minified"
-			);
-		}
-		choices.push(settings.compilerAddDebugFiles
+	},
+	compilerMinify: () => {
+		return (settings.compilerMinify
+			? "Build is minified"
+			: "Build is not minified"
+		);
+	},
+	compilerAddDebugFiles: () => {
+		return (settings.compilerAddDebugFiles
 			? "Adding *.debug.* files to the build"
 			: "Ignoring *.debug.* files"
 		);
-		if (settings.compilerRunSanityChecks === 0) {
-			choices.push("Not running sanity checks when compiling");
-		} else if (settings.compilerRunSanityChecks === 1) {
-			choices.push("Running sanity checks before compiling");
-		} else {
-			choices.push("Running sanity checks after compiling");
-		}
-		choices.push(settings.compilerFilenameHash
+	},
+	compilerFilenameHash: () => {
+		return (settings.compilerFilenameHash
 			? "Adding the current Git commit hash to the final filename"
 			: "Not adding the current Git commit hash to the final filename"
 		);
-		choices.push(settings.compilerFilenameEpoch
+	},
+	compilerFilenameEpoch: () => {
+		return (settings.compilerFilenameEpoch
 			? "Adding the current time to the final filename"
 			: "Not adding the current time to the final filename"
 		);
-		choices.push(settings.compilerFilenamePmodVersion
+	},
+	compilerFilenamePmodVersion: () => {
+		return (settings.compilerFilenamePmodVersion
 			? "Adding the current Pmod version to the final filename"
 			: "Not adding the current Pmod version to the final filename"
 		);
-		choices.push(`Verbosity level: ${settings.compilerVerbosity}`);
-		choices.push(settings.compilerCopyToFCHost
-			? "Copying compiled files to FCHost's directory"
-			: "Not copying compiled files to FCHost's directory"
+	},
+	compilerVerbosity: () => {
+		return `Verbosity level: ${settings.compilerVerbosity}`;
+	},
+	compilerRunSanityChecks: () => {
+		if (settings.compilerRunSanityChecks === 0) {
+			return "Not running sanity checks when compiling";
+		} else if (settings.compilerRunSanityChecks === 1) {
+			return "Running sanity checks before compiling";
+		} else {
+			return "Running sanity checks after compiling";
+		}
+	},
+	compilerWaitOnWindows: () => {
+		return (settings.compilerWaitOnWindows
+			? "Waiting for user input before exiting compiler"
+			: "Exiting compiler without user input"
 		);
-	} else if (settings.compilerMode === "simple") {
-		choices.push("Using the simple compiler, change to the advanced compiler for more options");
-		choices.push(settings.compileThemes
-			? "Themes are compiled"
-			: "Themes are not compiled"
+	},
+	precommitHookEnabled: () => {
+		if (settings.precommitHookEnabled === 0) {
+			return "Not running sanity checks before commiting";
+		} else if (settings.precommitHookEnabled === 1) {
+			return "Running sanity checks before commiting";
+		} else {
+			return "Sanity checks are temporarily disabled and will be re-enabled after the next commit";
+		}
+	},
+	checksEnableCustom: () => {
+		return (settings.checksEnableCustom
+			? "Custom sanity checks are enabled"
+			: "Custom sanity checks are disabled"
+		);
+	},
+	checksEnableSpelling: () => {
+		return (settings.checksEnableSpelling
+			? "Spelling checks are enabled"
+			: "Spelling checks are disabled"
+		);
+	},
+	checksEnableESLint: () => {
+		return (settings.checksEnableESLint
+			? "JavaScript linting is enabled"
+			: "JavaScript linting is disabled"
+		);
+	},
+	checksEnableTypescript: () => {
+		return (settings.checksEnableTypescript
+			? "JavaScript type checking is enabled"
+			: "JavaScript type checking is disabled"
+		);
+	},
+	checksOnlyChangedCustom: () => {
+		return (settings.checksOnlyChangedCustom
+			? "Custom sanity checks are only reporting problems on changed lines"
+			: "Custom sanity checks are reporting all problems"
+		);
+	},
+	checksOnlyChangedSpelling: () => {
+		return (settings.checksOnlyChangedSpelling
+			? "Spelling checks are only reporting problems on changed lines"
+			: "Spelling checks are reporting all problems"
+		);
+	},
+	checksOnlyChangedESLint: () => {
+		return (settings.checksOnlyChangedESLint
+			? "JavaScript linting is only reporting problems on changed lines"
+			: "JavaScript linting is reporting all problems"
 		);
+	},
+	checksOnlyChangedTypescript: () => {
+		return (settings.checksOnlyChangedTypescript
+			? "JavaScript type checking is only reporting problems on changed lines"
+			: "JavaScript type checking is reporting all problems"
+		);
+	},
+	manageNodePackages: () => {
+		if (settings.manageNodePackages === -1) {
+			return "Ignoring incorrect Node packages";
+		} else if (settings.manageNodePackages === 0) {
+			return "Asking about incorrect Node packages";
+		} else {
+			return "Automatically fixing incorrect Node packages";
+		}
+	},
+	fetchUpstreamBranch: () => {
+		if (settings.fetchUpstreamBranch === -1) {
+			return "Not fetching upstream pregmod-master branch. Sanity checks will report all errors";
+		} else if (settings.fetchUpstreamBranch === 0) {
+			return "Asking before fetching upstream pregmod-master branch";
+		} else {
+			return "Automatically pulling upstream pregmod-master branch. Sanity checks can report changed lines";
+		}
+	},
+	WatcherLiveReload: () => {
+		return (settings.WatcherLiveReload
+			? "Watcher is triggering a live reload on each successful build"
+			: "Watcher is not triggering a live reload on each successful build"
+		);
+	},
+	compilerCopyToFCHost: () => {
+		return (settings.compilerCopyToFCHost
+			? "Copying FC to FCHost's directory after a successful build"
+			: "Not copying FC to FCHost's directory"
+		);
+	},
+};
+
+let compilerMenuChoice;
+
+async function compilerSettings() {
+	let choices = [];
+	if (settings.compilerMode === "advanced") {
+		choices.push(strings.compilerMode());
+		choices.push(new inquirer.Separator(separatorString));
+		choices.push(strings.compileThemes());
+		choices.push(strings.compilerSourcemaps());
+		if (settings.compilerSourcemaps === false) {
+			choices.push(strings.compilerMinify());
+		}
+		choices.push(strings.compilerAddDebugFiles());
+		choices.push(strings.compilerFilenameHash());
+		choices.push(strings.compilerFilenameEpoch());
+		choices.push(strings.compilerFilenamePmodVersion());
+		choices.push(strings.compilerVerbosity());
+		choices.push(new inquirer.Separator(separatorString));
+		choices.push(strings.compilerRunSanityChecks());
+	} else {
+		choices.push(strings.compilerMode());
+		choices.push(new inquirer.Separator(separatorString));
+		choices.push(strings.compileThemes());
 	}
 	if (process.platform === "win32") {
-		choices.push(settings.compilerWaitOnWindows ? "Waiting for user input before exiting compiler" : "Exiting compiler without user input");
+		choices.push(strings.compilerWaitOnWindows());
 	}
 
 	choices.push("Back");
@@ -208,86 +336,61 @@ async function compilerSettings() {
 			compilerMenuChoice = answers.choice;
 		});
 
-	if (
-		compilerMenuChoice === "Using the advanced compiler" ||
-		compilerMenuChoice === "Using the simple compiler, change to the advanced compiler for more options"
-	) {
+	if (compilerMenuChoice === strings.compilerMode()) {
 		if (settings.compilerMode === "simple") {
 			settings.compilerMode = "advanced";
 		} else {
 			settings.compilerMode = "simple";
 		}
-	} else if (
-		compilerMenuChoice === "Themes are compiled" ||
-		compilerMenuChoice === "Themes are not compiled"
-	) {
+		compilerMenuChoice = strings.compilerMode();
+	} else if (compilerMenuChoice === strings.compileThemes()) {
 		settings.compileThemes = !settings.compileThemes;
-	} else if (
-		compilerMenuChoice === "Source maps are added, minification is disabled" ||
-		compilerMenuChoice === "Source maps are not added"
-	) {
+		compilerMenuChoice = strings.compileThemes();
+	} else if (compilerMenuChoice === strings.compilerSourcemaps()) {
 		settings.compilerSourcemaps = !settings.compilerSourcemaps;
 		if (settings.compilerSourcemaps === true) {
 			settings.compilerMinify = false;
 		}
-	} else if (
-		compilerMenuChoice === "Build is minified" ||
-		compilerMenuChoice === "Build is not minified"
-	) {
+		compilerMenuChoice = strings.compilerSourcemaps();
+	} else if (compilerMenuChoice === strings.compilerMinify()) {
 		settings.compilerMinify = !settings.compilerMinify;
-	} else if (
-		compilerMenuChoice === "Adding *.debug.* files to the build" ||
-		compilerMenuChoice === "Ignoring *.debug.* files"
-	) {
+		compilerMenuChoice = strings.compilerMinify();
+	} else if (compilerMenuChoice === strings.compilerAddDebugFiles()) {
 		settings.compilerAddDebugFiles = !settings.compilerAddDebugFiles;
-	} else if (
-		compilerMenuChoice === "Not running sanity checks when compiling" ||
-		compilerMenuChoice === "Running sanity checks before compiling" ||
-		compilerMenuChoice === "Running sanity checks after compiling"
-	) {
-		if (settings.compilerRunSanityChecks === 2) {
-			settings.compilerRunSanityChecks = 0;
-		} else {
-			settings.compilerRunSanityChecks += 1;
-		}
-	} else if (
-		compilerMenuChoice === "Adding the current Git commit hash to the final filename" ||
-		compilerMenuChoice === "Not adding the current Git commit hash to the final filename"
-	) {
+		compilerMenuChoice = strings.compilerAddDebugFiles();
+	} else if (compilerMenuChoice === strings.compilerFilenameHash()) {
 		settings.compilerFilenameHash = !settings.compilerFilenameHash;
-	} else if (
-		compilerMenuChoice === "Adding the current time to the final filename" ||
-		compilerMenuChoice === "Not adding the current time to the final filename"
-	) {
+		compilerMenuChoice = strings.compilerFilenameHash();
+	} else if (compilerMenuChoice === strings.compilerFilenameEpoch()) {
 		settings.compilerFilenameEpoch = !settings.compilerFilenameEpoch;
-	} else if (
-		compilerMenuChoice === "Adding the current Pmod version to the final filename" ||
-		compilerMenuChoice === "Not adding the current Pmod version to the final filename"
-	) {
+		compilerMenuChoice = strings.compilerFilenameEpoch();
+	} else if (compilerMenuChoice === strings.compilerFilenamePmodVersion()) {
 		settings.compilerFilenamePmodVersion = !settings.compilerFilenamePmodVersion;
-	} else if (compilerMenuChoice === `Verbosity level: ${settings.compilerVerbosity}`) {
+		compilerMenuChoice = strings.compilerFilenamePmodVersion();
+	} else if (compilerMenuChoice === strings.compilerVerbosity()) {
 		if (settings.compilerVerbosity === 6) {
 			settings.compilerVerbosity = 1;
 		} else {
 			settings.compilerVerbosity += 1;
 		}
-	} else if (
-		compilerMenuChoice === "Copying compiled files to FCHost's directory" ||
-		compilerMenuChoice === "Not copying compiled files to FCHost's directory"
-	) {
-		settings.compilerCopyToFCHost = !settings.compilerCopyToFCHost;
-	} else if (
-		compilerMenuChoice === "Waiting for user input before exiting compiler" ||
-		compilerMenuChoice === "Exiting compiler without user input"
-	) {
+		compilerMenuChoice = strings.compilerVerbosity();
+	} else if (compilerMenuChoice === strings.compilerRunSanityChecks()) {
+		if (settings.compilerRunSanityChecks === 2) {
+			settings.compilerRunSanityChecks = 0;
+		} else {
+			settings.compilerRunSanityChecks += 1;
+		}
+		compilerMenuChoice = strings.compilerRunSanityChecks();
+	} else if (compilerMenuChoice === strings.compilerWaitOnWindows()) {
 		settings.compilerWaitOnWindows = !settings.compilerWaitOnWindows;
+		compilerMenuChoice = strings.compilerWaitOnWindows();
 	} else if (compilerMenuChoice === "Back") {
 		compilerMenuChoice = 0;
 		return;
+	} else {
+		throw new Error("Invalid compiler menu choice: " + compilerMenuChoice);
 	}
 
-	compilerMenuChoice = choices.indexOf(compilerMenuChoice);
-
 	await compilerSettings();
 }
 
@@ -295,59 +398,25 @@ let sanityCheckMenuChoice;
 
 async function sanityCheckSettings() {
 	let choices = [];
-	if (settings.precommitHookEnabled === 0) {
-		choices.push("Not running sanity checks before commiting");
-	} else if (settings.precommitHookEnabled === 1) {
-		choices.push("Running sanity checks before commiting");
-	} else {
-		choices.push("Sanity checks are temporarily disabled and will be re-enabled after the next commit");
-	}
-	if (settings.compilerRunSanityChecks === 0) {
-		choices.push("Not running sanity checks when compiling");
-	} else if (settings.compilerRunSanityChecks === 1) {
-		choices.push("Running sanity checks before compiling");
-	} else {
-		choices.push("Running sanity checks after compiling");
-	}
-	choices.push(settings.checksEnableCustom
-		? "Custom sanity checks are enabled"
-		: "Custom sanity checks are disabled"
-	);
-	choices.push(settings.checksEnableSpelling
-		? "Spelling checks are enabled"
-		: "Spelling checks are disabled"
-	);
-	choices.push(settings.checksEnableESLint
-		? "JavaScript linting is enabled"
-		: "JavaScript linting is disabled"
-	);
-	choices.push(settings.checksEnableTypescript
-		? "JavaScript type checking is enabled"
-		: "JavaScript type checking is disabled"
-	);
+	choices.push(strings.precommitHookEnabled());
+	choices.push(strings.compilerRunSanityChecks());
+	choices.push(new inquirer.Separator(separatorString));
+	choices.push(strings.checksEnableCustom());
+	choices.push(strings.checksEnableSpelling());
+	choices.push(strings.checksEnableESLint());
+	choices.push(strings.checksEnableTypescript());
+	choices.push(new inquirer.Separator(separatorString));
 	if (settings.checksEnableCustom === true) {
-		choices.push(settings.checksOnlyChangedCustom
-			? "Custom sanity checks are only reporting problems on changed lines"
-			: "Custom sanity checks are reporting all problems"
-		);
+		choices.push(strings.checksOnlyChangedCustom());
 	}
 	if (settings.checksEnableSpelling === true) {
-		choices.push(settings.checksOnlyChangedSpelling
-			? "Spelling checks are only reporting problems on changed lines"
-			: "Spelling checks are reporting all problems"
-		);
+		choices.push(strings.checksOnlyChangedSpelling());
 	}
 	if (settings.checksEnableESLint === true) {
-		choices.push(settings.checksOnlyChangedESLint
-			? "JavaScript linting is only reporting problems on changed lines"
-			: "JavaScript linting is reporting all problems"
-		);
+		choices.push(strings.checksOnlyChangedESLint());
 	}
 	if (settings.checksEnableTypescript === true) {
-		choices.push(settings.checksOnlyChangedTypescript
-			? "JavaScript type checking is only reporting problems on changed lines"
-			: "JavaScript type checking is reporting all problems"
-		);
+		choices.push(strings.checksOnlyChangedTypescript());
 	}
 
 	choices.push("Back");
@@ -365,11 +434,7 @@ async function sanityCheckSettings() {
 		.then((answers) => {
 			sanityCheckMenuChoice = answers.choice;
 		});
-	if (
-		sanityCheckMenuChoice === "Running sanity checks before commiting" ||
-		sanityCheckMenuChoice === "Not running sanity checks before commiting" ||
-		sanityCheckMenuChoice === "Sanity checks are temporarily disabled and will be re-enabled after the next commit"
-	) {
+	if (sanityCheckMenuChoice === strings.precommitHookEnabled()) {
 		if (settings.precommitHookEnabled === -1) {
 			settings.precommitHookEnabled = 0;
 		} else if (settings.precommitHookEnabled === 0) {
@@ -377,91 +442,59 @@ async function sanityCheckSettings() {
 		} else {
 			settings.precommitHookEnabled = -1;
 		}
-	} else if (
-		sanityCheckMenuChoice === "Not running sanity checks when compiling" ||
-		sanityCheckMenuChoice === "Running sanity checks before compiling" ||
-		sanityCheckMenuChoice === "Running sanity checks after compiling"
-	) {
+		sanityCheckMenuChoice = strings.precommitHookEnabled();
+	} else if (sanityCheckMenuChoice === strings.compilerRunSanityChecks()) {
 		if (settings.compilerRunSanityChecks === 2) {
 			settings.compilerRunSanityChecks = 0;
 		} else {
 			settings.compilerRunSanityChecks += 1;
 		}
-	} else if (
-		sanityCheckMenuChoice === "Custom sanity checks are enabled" ||
-		sanityCheckMenuChoice === "Custom sanity checks are disabled"
-	) {
+		sanityCheckMenuChoice = strings.compilerRunSanityChecks();
+	} else if (sanityCheckMenuChoice === strings.checksEnableCustom()) {
 		settings.checksEnableCustom = !settings.checksEnableCustom;
-	} else if (
-		sanityCheckMenuChoice === "Spelling checks are enabled" ||
-		sanityCheckMenuChoice === "Spelling checks are disabled"
-	) {
+		sanityCheckMenuChoice = strings.checksEnableCustom();
+	} else if (sanityCheckMenuChoice === strings.checksEnableSpelling()) {
 		settings.checksEnableSpelling = !settings.checksEnableSpelling;
-	} else if (
-		sanityCheckMenuChoice === "JavaScript linting is enabled" ||
-		sanityCheckMenuChoice === "JavaScript linting is disabled"
-	) {
+		sanityCheckMenuChoice = strings.checksEnableSpelling();
+	} else if (sanityCheckMenuChoice === strings.checksEnableESLint()) {
 		settings.checksEnableESLint = !settings.checksEnableESLint;
-	} else if (
-		sanityCheckMenuChoice === "JavaScript type checking is enabled" ||
-		sanityCheckMenuChoice === "JavaScript type checking is disabled"
-	) {
+		sanityCheckMenuChoice = strings.checksEnableESLint();
+	} else if (sanityCheckMenuChoice === strings.checksEnableTypescript()) {
 		settings.checksEnableTypescript = !settings.checksEnableTypescript;
-	} else if (
-		sanityCheckMenuChoice === "Custom sanity checks are only reporting problems on changed lines" ||
-		sanityCheckMenuChoice === "Custom sanity checks are reporting all problems"
-	) {
+		sanityCheckMenuChoice = strings.checksEnableTypescript();
+	} else if (sanityCheckMenuChoice === strings.checksOnlyChangedCustom()) {
 		settings.checksOnlyChangedCustom = !settings.checksOnlyChangedCustom;
-	} else if (
-		sanityCheckMenuChoice === "Spelling checks are only reporting problems on changed lines" ||
-		sanityCheckMenuChoice === "Spelling checks are reporting all problems"
-	) {
+		sanityCheckMenuChoice = strings.checksOnlyChangedCustom();
+	} else if (sanityCheckMenuChoice === strings.checksOnlyChangedSpelling()) {
 		settings.checksOnlyChangedSpelling = !settings.checksOnlyChangedSpelling;
-	} else if (
-		sanityCheckMenuChoice === "JavaScript linting is only reporting problems on changed lines" ||
-		sanityCheckMenuChoice === "JavaScript linting is reporting all problems"
-	) {
+		sanityCheckMenuChoice = strings.checksOnlyChangedSpelling();
+	} else if (sanityCheckMenuChoice === strings.checksOnlyChangedESLint()) {
 		settings.checksOnlyChangedESLint = !settings.checksOnlyChangedESLint;
-	} else if (
-		sanityCheckMenuChoice === "JavaScript type checking is only reporting problems on changed lines" ||
-		sanityCheckMenuChoice === "JavaScript type checking is reporting all problems"
-	) {
+		sanityCheckMenuChoice = strings.checksOnlyChangedESLint();
+	} else if (sanityCheckMenuChoice === strings.checksOnlyChangedTypescript()) {
 		settings.checksOnlyChangedTypescript = !settings.checksOnlyChangedTypescript;
+		sanityCheckMenuChoice = strings.checksOnlyChangedTypescript();
 	} else if (
 		sanityCheckMenuChoice === "Back"
 	) {
 		sanityCheckMenuChoice = 0;
 		return;
+	} else {
+		throw new Error("Invalid sanity check menu choice: " + sanityCheckMenuChoice);
 	}
 
-	sanityCheckMenuChoice = choices.indexOf(sanityCheckMenuChoice);
-
 	await sanityCheckSettings();
 }
 
-let MiscMenuChoice;
+let miscMenuChoice;
 
 async function MiscSettings() {
 	let choices = [];
-	if (settings.manageNodePackages === -1) {
-		choices.push("Ignoring incorrect Node packages");
-	} else if (settings.manageNodePackages === 0) {
-		choices.push("Asking about incorrect Node packages");
-	} else {
-		choices.push("Automatically fixing incorrect Node packages");
-	}
-	if (settings.fetchUpstreamBranch === -1) {
-		choices.push("Not fetching upstream pregmod-master branch. Sanity checks will report all errors");
-	} else if (settings.fetchUpstreamBranch === 0) {
-		choices.push("Asking before fetching upstream pregmod-master branch");
-	} else {
-		choices.push("Automatically pulling upstream pregmod-master branch. Sanity checks can report changed lines");
-	}
-	choices.push(settings.WatcherLiveReload
-		? "Watcher is triggering a live reload on each successful build"
-		: "Watcher is not triggering a live reload on each successful build"
-	);
-
+	choices.push(strings.manageNodePackages());
+	choices.push(strings.fetchUpstreamBranch());
+	choices.push(new inquirer.Separator(separatorString));
+	choices.push(strings.WatcherLiveReload());
+	choices.push(strings.compilerCopyToFCHost());
 	choices.push("Back");
 
 	await inquirer
@@ -470,45 +503,41 @@ async function MiscSettings() {
 			name: "choice",
 			message: "Miscellaneous Settings",
 			choices: choices,
-			default: MiscMenuChoice,
+			default: miscMenuChoice,
 			loop: false,
 			pageSize: 11
 		}])
 		.then((answers) => {
-			MiscMenuChoice = answers.choice;
+			miscMenuChoice = answers.choice;
 		});
 
-	if (
-		MiscMenuChoice === "Ignoring incorrect Node packages" ||
-		MiscMenuChoice === "Asking about incorrect Node packages" ||
-		MiscMenuChoice === "Automatically fixing incorrect Node packages"
-	) {
+	if (miscMenuChoice === strings.manageNodePackages()) {
 		if (settings.manageNodePackages === 1) {
 			settings.manageNodePackages = -1;
 		} else {
 			settings.manageNodePackages += 1;
 		}
-	} else if (
-		MiscMenuChoice === "Not fetching upstream pregmod-master branch. Sanity checks will report all errors" ||
-		MiscMenuChoice === "Asking before fetching upstream pregmod-master branch" ||
-        MiscMenuChoice === "Automatically pulling upstream pregmod-master branch. Sanity checks can report changed lines"
-	) {
+		miscMenuChoice = strings.manageNodePackages();
+	} else if (miscMenuChoice === strings.fetchUpstreamBranch()) {
 		if (settings.fetchUpstreamBranch === 1) {
 			settings.fetchUpstreamBranch = -1;
 		} else {
 			settings.fetchUpstreamBranch += 1;
 		}
-	} else if (
-		MiscMenuChoice === "Watcher is triggering a live reload on each successful build" ||
-		MiscMenuChoice === "Watcher is not triggering a live reload on each successful build"
-	) {
+		miscMenuChoice = strings.fetchUpstreamBranch();
+	} else if (miscMenuChoice === strings.WatcherLiveReload()) {
 		settings.WatcherLiveReload = !settings.WatcherLiveReload;
-	} else if (MiscMenuChoice === "Back") {
+		miscMenuChoice = strings.WatcherLiveReload();
+	} else if (miscMenuChoice === strings.compilerCopyToFCHost()) {
+		settings.compilerCopyToFCHost = !settings.compilerCopyToFCHost;
+		miscMenuChoice = strings.compilerCopyToFCHost();
+	} else if (miscMenuChoice === "Back") {
+		miscMenuChoice = 0;
 		return;
+	} else {
+		throw new Error("Invalid misc menu choice: " + miscMenuChoice);
 	}
 
-	MiscMenuChoice = choices.indexOf(MiscMenuChoice);
-
 	await MiscSettings();
 }
 
@@ -555,6 +584,8 @@ async function mainMenu() {
         mainMenuChoice === "Exit"
 	) {
 		process.exit(0);
+	} else {
+		throw new Error("Invalid main menu choice: " + mainMenuChoice);
 	}
 
 	mainMenuChoice = choices.indexOf(mainMenuChoice);
-- 
GitLab