Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (format) {
//
// Iterate over the procs to see which has the
// longest options string
//
procs.forEach(function (proc) {
rows.push(mapColumns('[' + index + ']', function (column) {
return forever.columns[column]
? forever.columns[column].get(proc)
: 'MISSING';
}));
index++;
});
formatted = cliff.stringifyRows(rows, mapColumns('white', function (column) {
return forever.columns[column]
? forever.columns[column].color
: 'white';
}));
}
return format ? formatted : procs;
};
if (format) {
//
// Iterate over the procs to see which has the
// longest options string
//
procs.forEach(function (proc) {
rows.push(mapColumns('[' + index + ']', function (column) {
return forever.columns[column]
? forever.columns[column].get(proc)
: 'MISSING';
}));
index++;
});
formatted = cliff.stringifyRows(rows, mapColumns('white', function (column) {
return forever.columns[column]
? forever.columns[column].color
: 'white';
}));
}
return format ? formatted : procs;
};
if (format) {
//
// Iterate over the procs to see which has the
// longest options string
//
procs.forEach(function (proc) {
rows.push(mapColumns('[' + index + ']', function (column) {
return forever.columns[column]
? forever.columns[column].get(proc)
: 'MISSING';
}));
index++;
});
formatted = cliff.stringifyRows(rows, mapColumns('white', function (column) {
return forever.columns[column]
? forever.columns[column].color
: 'white';
}));
}
return format ? formatted : procs;
};
return 1;
} else if (a.serverId < b.serverId) {
return -1;
} else if (a.serverId > b.serverId) {
return 1;
} else {
return 0;
}
};
servers.sort(comparer);
let rows: string[][] = [];
rows.push(['serverId', 'serverType', 'pid', 'rss(M)', 'heapTotal(M)', 'heapUsed(M)', 'uptime(m)']);
servers.forEach(function (server) {
rows.push([server.serverId, server.serverType, server.pid, server.rss, server.heapTotal, server.heapUsed, server.uptime]);
});
console.log(cliff.stringifyRows(rows, ['red', 'blue', 'green', 'cyan', 'magenta', 'white', 'yellow']));
process.exit(0);
});
});
.action(function(name, options) {
let api = apis[name];
if (api === undefined) {
console.log('No API named: ' + name);
process.exit(1);
}
console.log(cliff.inspect(api));
});
load_plugins(nell_site, function(err) {
if (err) {
return done(err);
}
Object.keys(nell_site.plugins_desc).forEach(function(plugin) {
plugin = nell_site.plugins_desc[plugin];
rows.push([plugin.key, plugin.args, plugin.desc]);
});
console.log(cliff.stringifyRows(rows, ['red', 'blue', 'green']));
done(null);
});
}
.action(function() {
let rows = [
['Name', 'referenceUrl'],
].concat(_.keys(apis).map(function(name) {
return [name, apis[name].referenceUrl];
}));
console.log(cliff.stringifyRows(rows));
});
delete s.buy_order
delete s.sell_order
console.log('\nmanual'.grey + ' order cancel' + ' command executed'.grey)
} else if (key === 'm' && !info.ctrl && so.mode === 'live') {
so.manual = !so.manual
console.log('\nMANUAL trade in LIVE mode: ' + (so.manual ? 'ON'.green.inverse : 'OFF'.red.inverse))
} else if (key === 'T' && !info.ctrl) {
so.order_type = 'taker'
console.log('\n' + 'Taker fees activated'.bgRed)
} else if (key === 'M' && !info.ctrl) {
so.order_type = 'maker'
console.log('\n' + 'Maker fees activated'.black.bgGreen)
} else if (key === 'o' && !info.ctrl) {
listOptions()
} else if (key === 'O' && !info.ctrl) {
console.log('\n' + cliff.inspect(so))
} else if (key === 'P' && !info.ctrl) {
console.log('\nWriting statistics...'.grey)
printTrade(false)
} else if (key === 'X' && !info.ctrl) {
console.log('\nExiting... ' + '\nWriting statistics...'.grey)
printTrade(true)
} else if (key === 'd' && !info.ctrl) {
console.log('\nDumping statistics...'.grey)
printTrade(false, true)
} else if (key === 'D' && !info.ctrl) {
console.log('\nDumping statistics...'.grey)
toggleStats()
} else if (key === 'L' && !info.ctrl) {
debug.flip()
console.log('\nDEBUG mode: ' + (debug.on ? 'ON'.green.inverse : 'OFF'.red.inverse))
} else if (info.name === 'c' && info.ctrl) {
cli.withStdinLines(function (lines) {
for (var i = 0; i < lines.length; i++) {
if (lines[i] === '') {
continue;
}
var address = new v6.Address(lines[i]);
if (options.v) {
this.output(sprintf('%s = %s\n', lines[i], cliff.inspect(address)));
} else if (options.c) {
rows.push([
lines[i],
address.isValid() ? 'Yes' : 'No'.red,
address.isValid() ? address.correctForm() : '',
address.isValid() ? address.canonicalForm() : ''
]);
} else {
this.output(sprintf('%s,%s\n', lines[i], address.isValid() ? 'valid' : 'invalid'));
}
}
if (options.c) {
console.log(cliff.stringifyRows(rows, ['green', 'green', 'green', 'green']));
}
});
app.cmd('config', cli.config = function () {
var keys = Object.keys(forever.config.store),
conf = cliff.inspect(forever.config.store);
if (keys.length <= 2) {
conf = conf.replace(/\{\s/, '{ \n')
.replace(/\}/, '\n}')
.replace('\\033[90m', ' \\033[90m')
.replace(/, /ig, ',\n ');
}
else {
conf = conf.replace(/\n\s{4}/ig, '\n ');
}
conf.split('\n').forEach(function (line) {
forever.log.data(line);
});
});