From 17691b54c0ed1c025ad119a3216ade44ad87bbbe Mon Sep 17 00:00:00 2001 From: CosminPerRam Date: Tue, 16 Jan 2024 02:14:02 +0200 Subject: [PATCH] chore: cleaner CLI Related: #459 --- bin/gamedig.js | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/bin/gamedig.js b/bin/gamedig.js index b4ce91b..d033596 100644 --- a/bin/gamedig.js +++ b/bin/gamedig.js @@ -27,23 +27,12 @@ if (argv._.length >= 1) { const target = argv._[0] const split = target.split(':') options.host = split[0] - if (split.length >= 2) { + if (split.length > 1) { options.port = split[1] } } -const applyBoolean = (value, fieldName, defaultValue = true) => { - if (value) { - options[fieldName] = defaultValue - } -} - -const { debug, pretty, givenPortOnly, requestRulesRequired, requestPlayersRequired } = argv - -applyBoolean(debug, 'debug') -applyBoolean(givenPortOnly, 'givenPortOnly') -applyBoolean(requestRulesRequired, 'requestRulesRequired') -applyBoolean(requestPlayersRequired, 'requestPlayersRequired') +const { debug, pretty } = options const printOnPretty = (object) => { if (!!pretty || debug) {