mirror of
https://github.com/tribufu/node-gamedig
synced 2026-05-06 07:07:33 +00:00
Initial es6 async conversion work
This commit is contained in:
parent
a054557f10
commit
77b2cc1c7f
10 changed files with 773 additions and 748 deletions
|
|
@ -5,7 +5,7 @@ const argv = require('minimist')(process.argv.slice(2)),
|
|||
|
||||
const debug = argv.debug;
|
||||
delete argv.debug;
|
||||
const outputFormat = argv.output;
|
||||
const pretty = !!argv.pretty;
|
||||
delete argv.output;
|
||||
|
||||
const options = {};
|
||||
|
|
@ -25,7 +25,7 @@ Gamedig.isCommandLine = true;
|
|||
|
||||
Gamedig.query(options)
|
||||
.then((state) => {
|
||||
if(outputFormat === 'pretty') {
|
||||
if(pretty) {
|
||||
console.log(JSON.stringify(state,null,' '));
|
||||
} else {
|
||||
console.log(JSON.stringify(state));
|
||||
|
|
@ -42,7 +42,7 @@ Gamedig.query(options)
|
|||
if (error instanceof Error) {
|
||||
error = error.message;
|
||||
}
|
||||
if (outputFormat === 'pretty') {
|
||||
if (pretty) {
|
||||
console.log(JSON.stringify({error: error}, null, ' '));
|
||||
} else {
|
||||
console.log(JSON.stringify({error: error}));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue