Skip to content

Commit

Permalink
1.0.3
Browse files Browse the repository at this point in the history
- Fix CLI commands being mapped to incorrect functions
  • Loading branch information
Nixinova committed Apr 6, 2021
1 parent 97feb43 commit fa54168
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 17 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.0.3
*2021-04-06*
- Fixed CLI commands being mapped to incorrect functions.

## 1.0.2
*2021-04-04*
- Added configuration file version.
Expand Down
21 changes: 11 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const fs = require('fs');
const download = require('download');
const curseforge = require('mc-curseforge-api');

const VERSION = '1.0.2';
const VERSION = '1.0.3';
const MODS_FILE = 'mods.json';

function getConfig() { return JSON.parse(fs.readFileSync(MODS_FILE, { encoding: 'utf8' }, data => data)); }
Expand Down Expand Up @@ -53,7 +53,7 @@ async function install(srcArg, modID) {
fs.writeFile(MODS_FILE, JSON.stringify(modsJson, {}, 4), { encoding: 'utf8' }, data => data);
}

async function remove(a,b) {
async function remove(a, b) {
const modID = b || a;
const modsJson = getConfig();
if (!modsJson.mods[modID]) return;
Expand All @@ -74,17 +74,18 @@ async function update() {
}
}

module.exports = { install, remove, update, setup };
module.exports = { setup, install, remove, update };

const args = process.argv.slice(2);
if (args[0]) {
if (args[0].includes('h')) console.log(`
const cmd = args[0];
if (/^-*h/.test(cmd)) console.log(`
ModManager commands:
modmanager help
Display this help message.
modmanager setup <mcVersion>
Initialise a 'mods.json' listing file with a given Minecraft version.
Initialise a 'mods.json' configuration file with a given Minecraft version.
modmanager install curse <modID>
Install a mod from CurgeForge, saving its metadata to 'mods.json'.
modmanager remove [curse] <modID>
Expand All @@ -94,9 +95,9 @@ if (args[0]) {
modmanager version
Display the current version of ModManager.
`);
else if (args[0].includes('s')) setup(args[1]).catch(e => console.error(e));
else if (args[0].includes('i')) install(args[1], args[2]).catch(e => console.error(e));
else if (args[0].includes('r')) remove(args[1]).catch(e => console.error(e));
else if (args[0].includes('u')) update().catch(e => console.error(e));
else if (args[0].includes('v')) console.log(`The current version of ModManager is ${VERSION}`)
else if (/^-*s/.test(cmd)) setup(args[1]).catch(e => console.error(e));
else if (/^-*i/.test(cmd)) install(args[1], args[2]).catch(e => console.error(e));
else if (/^-*r/.test(cmd)) remove(args[1]).catch(e => console.error(e));
else if (/^-*u/.test(cmd)) update().catch(e => console.error(e));
else if (/^-*v/.test(cmd)) console.log(`The current version of ModManager is ${VERSION}`)
}
1 change: 1 addition & 0 deletions mods.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"version": {
"config": 1,
"minecraft": "1.16"
},
"mods": {
Expand Down
11 changes: 7 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mcmodmanager",
"version": "1.0.2",
"version": "1.0.3",
"description": "Keep your Minecraft Forge mods up to date using a simple CLI.",
"main": "index.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ modmanager setup 1.16

Now you can install whatever mods you want from CurseForge.
To do so, simply go to the CurseForge page of your mod and copy its Project ID found on the right-hand side of the page.
Then enter this project ID (`238222` in this example) into the `modcrafter install` command:
Then enter this project ID (`238222` in this example) into the `modmanager install` command:

```cmd
modcrafter install curse 238222
modmanager install curse 238222
```

This will install the version of mod `238222` that corresponds to your configured Minecraft version in `mods.json` (in this case, 1.16), given that there is a 1.16 version of the mod available.
Expand Down

0 comments on commit fa54168

Please sign in to comment.