mirror of
https://github.com/gamedig/node-gamedig.git
synced 2024-11-17 17:25:19 +01:00
parent
a8bc3aa098
commit
17691b54c0
1 changed files with 2 additions and 13 deletions
|
@ -27,23 +27,12 @@ if (argv._.length >= 1) {
|
||||||
const target = argv._[0]
|
const target = argv._[0]
|
||||||
const split = target.split(':')
|
const split = target.split(':')
|
||||||
options.host = split[0]
|
options.host = split[0]
|
||||||
if (split.length >= 2) {
|
if (split.length > 1) {
|
||||||
options.port = split[1]
|
options.port = split[1]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const applyBoolean = (value, fieldName, defaultValue = true) => {
|
const { debug, pretty } = options
|
||||||
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 printOnPretty = (object) => {
|
const printOnPretty = (object) => {
|
||||||
if (!!pretty || debug) {
|
if (!!pretty || debug) {
|
||||||
|
|
Loading…
Reference in a new issue