diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..ef3f9b3 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,17 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Debug Main Process", + "type": "node", + "request": "launch", + "cwd": "${workspaceFolder}", + "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron", + "windows": { + "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron.cmd" + }, + "args" : ["."], + "outputCapture": "std" + } + ] + } \ No newline at end of file diff --git a/cli/cli-main.js b/cli/cli-main.js new file mode 100644 index 0000000..c37c302 --- /dev/null +++ b/cli/cli-main.js @@ -0,0 +1,50 @@ +#!/usr/bin/env node +const yargs = require('yargs/yargs') +const { hideBin } = require('yargs/helpers') + +yargs(hideBin(process.argv)) + .command('list [region]', 'List all currently known IP ranges (and cluster ids) on a given Cluster ID', (yargs) => { // todo re-work description its gross + return yargs + .positional('region', { + describe: 'specific geographic region/cluster for Matchmaking Servers', + default: 'all' + }) + }, (argv) => { + if (argv.verbose) console.info(`List servers on :${argv.region}`) + + console.log('Listed the Servers'); + }) + .command('reset', 'Remove all CSGO Matchmaking Server Firewall rules', (argv) => { + + console.log('🔥🔥🔥 All firewall rules removed successfully! 🔥🔥🔥') + }) + .command('set region [regionid]', 'Sets a given specified region as the default for Matchmaking', (yargs) => { + return yargs + .positional('regionid', { + describe: 'specific geographic region for Matchmaking Servers', + default: 'oc' + }) + }, (argv) => { + + console.log(`Set region: ${argv.regionid} for CSGO Matchmaking. Firewall has been changed.`) + }) + .command('ping region [regionid] [amount]', 'Pings a given specified region/cluster and displays output.', (yargs) => { + return yargs + .positional('regionid', { + describe: 'specific geographic region for Matchmaking Servers', + default: 'oc' + }) + .positional('amount', { + describe: 'The amount of times to ping a particular region\'s servers', + default: '5' + }) + }, (argv) => { + + console.log(`Pinging region: ${argv.regionid}, ${argv.amount} times for CSGO Matchmaking. ⚠ Firewall has NOT been changed. ⚠`) + }) + .option('verbose', { + alias: 'v', + type: 'boolean', + description: 'Run with verbose logging' + }) + .argv diff --git a/cli/package.json b/cli/package.json new file mode 100644 index 0000000..6f7d6c6 --- /dev/null +++ b/cli/package.json @@ -0,0 +1,38 @@ +{ + "name": "csgo-mm-picker-cli", + "version": "0.0.1", + "description": "A command-line interface option for the CSGO Matchmaking Server Picker", + "main": "cli-main.js", + "scripts": { + "test": "echo \"No tests currently available.\" && exit 1", + "csgo-server-picker": "node cli-main.js" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Jyben/csgo-mm-server-picker.git" + }, + "devDependencies": { + "electron": "^9.4.0", + "electron-builder": "^22.9.1" + }, + "dependencies": { + "axios": "^0.21.1", + "electron-log": "^3.0.6", + "electron-updater": "^4.3.1", + "glob": "^7.1.4", + "simple-node-logger": "^18.12.24", + "sudo-prompt": "^8.2.5", + "yargs": "^16.2.0" + }, + "keywords": [ + "csgo", + "mm", + "cli" + ], + "author": "Adam Grande", + "license": "MIT", + "bugs": { + "url": "https://github.com/Jyben/csgo-mm-server-picker/issues" + }, + "homepage": "https://github.com/Jyben/csgo-mm-server-picker#readme" +} diff --git a/package-lock.json b/package-lock.json index 1208c93..b96de78 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "csgo-mm-server-picker", - "version": "v1.1.2", + "version": "v1.1.5", "lockfileVersion": 1, "requires": true, "dependencies": {