Skip to content

Commit

Permalink
chore: cleaner CLI
Browse files Browse the repository at this point in the history
Related: #459
  • Loading branch information
CosminPerRam committed Jan 16, 2024
1 parent a8bc3aa commit 17691b5
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions bin/gamedig.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 17691b5

Please sign in to comment.