mirror of
https://github.com/tribufu/node-gamedig
synced 2026-05-06 07:07:33 +00:00
Additional async rewrite
This commit is contained in:
parent
efe12a00aa
commit
29ce0b82d0
24 changed files with 654 additions and 470 deletions
|
|
@ -5,8 +5,8 @@ const argv = require('minimist')(process.argv.slice(2)),
|
|||
|
||||
const debug = argv.debug;
|
||||
delete argv.debug;
|
||||
const pretty = !!argv.pretty;
|
||||
delete argv.output;
|
||||
const pretty = !!argv.pretty || debug;
|
||||
delete argv.pretty;
|
||||
|
||||
const options = {};
|
||||
for(const key of Object.keys(argv)) {
|
||||
|
|
@ -14,14 +14,21 @@ for(const key of Object.keys(argv)) {
|
|||
if(
|
||||
key === '_'
|
||||
|| key.charAt(0) === '$'
|
||||
|| (typeof value !== 'string' && typeof value !== 'number')
|
||||
)
|
||||
continue;
|
||||
options[key] = value;
|
||||
}
|
||||
|
||||
if (argv._.length >= 1) {
|
||||
const target = argv._[0];
|
||||
const split = target.split(':');
|
||||
options.host = split[0];
|
||||
if (split.length >= 2) {
|
||||
options.port = split[1];
|
||||
}
|
||||
}
|
||||
|
||||
if(debug) Gamedig.debug = true;
|
||||
Gamedig.isCommandLine = true;
|
||||
|
||||
Gamedig.query(options)
|
||||
.then((state) => {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
const fs = require('fs'),
|
||||
TypeResolver = require('../lib/typeresolver');
|
||||
TypeResolver = require('../lib/GameResolver');
|
||||
|
||||
const generated = TypeResolver.printReadme();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue