Additional async rewrite

This commit is contained in:
mmorrison 2019-01-12 04:43:36 -06:00
parent efe12a00aa
commit 29ce0b82d0
24 changed files with 654 additions and 470 deletions

View file

@ -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) => {

View file

@ -1,7 +1,7 @@
#!/usr/bin/env node
const fs = require('fs'),
TypeResolver = require('../lib/typeresolver');
TypeResolver = require('../lib/GameResolver');
const generated = TypeResolver.printReadme();