diff options
author | 0neGal <mail@0negal.com> | 2022-01-08 15:05:35 +0100 |
---|---|---|
committer | 0neGal <mail@0negal.com> | 2022-01-08 15:13:07 +0100 |
commit | 1c12fb2e90d26e25be6206076ad6762fa92a5962 (patch) | |
tree | 89e0035a458948f58ccc9b4aa4cac7fccb523cd5 /src/utils.js | |
parent | 927def020baf544a23140ba8cfa53dcef9f23aa8 (diff) | |
download | Viper-1c12fb2e90d26e25be6206076ad6762fa92a5962.tar.gz Viper-1c12fb2e90d26e25be6206076ad6762fa92a5962.zip |
added cli arguments for mods
This adds both the arguments themselves, but also their entries in the
man page and help page.
Diffstat (limited to 'src/utils.js')
-rw-r--r-- | src/utils.js | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/utils.js b/src/utils.js index 18c52da..1e05fed 100644 --- a/src/utils.js +++ b/src/utils.js @@ -245,7 +245,9 @@ const mods = { } let installed = () => { + console.log(lang("cli.mods.installed")); cli.exit(); + winLog(lang("gui.mods.installedmod")) ipcMain.emit("guigetmods"); } @@ -314,6 +316,12 @@ const mods = { } let modName = mods.get(mod).FolderName; + if (! modName) { + console.log("error: " + lang("cli.mods.cantfind")) + cli.exit(1); + return; + } + let modPath = path.join(modpath, modName); if (mods.get(mod).Disabled) { @@ -322,18 +330,22 @@ const mods = { if (fs.statSync(modPath).isDirectory()) { fs.rmSync(modPath, {recursive: true}); + console.log(lang("cli.mods.removed")); cli.exit(); ipcMain.emit("guigetmods"); } else { cli.exit(1); } }, - toggle: (mod) => { + toggle: (mod, fork) => { if (mod == "allmods") { let modlist = mods.list().all; for (let i = 0; i < modlist.length; i++) { - mods.toggle(modlist[i].Name) + mods.toggle(modlist[i].Name, true) } + + console.log(lang("cli.mods.toggledall")); + cli.exit(0); return } @@ -343,6 +355,12 @@ const mods = { } let modName = mods.get(mod).FolderName; + if (! modName) { + console.log("error: " + lang("cli.mods.cantfind")) + cli.exit(1); + return; + } + let modPath = path.join(modpath, modName); let dest = path.join(disabled, modName); @@ -352,6 +370,10 @@ const mods = { } fs.moveSync(modPath, dest) + if (! fork) { + console.log(lang("cli.mods.toggled")); + cli.exit(); + } ipcMain.emit("guigetmods"); } }; |