Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
argv.SID.forEach((sid) => {
const sub = db.find({ sid }); // bad use XD
if (!sub) {
print.error(l10n('CMD_LS_SID_NOT_FOUND', { sid }));
process.exit(1);
}
const { title, keywords, unkeywords, episodeParser } = sub;
const t = {};
t[l10n('CMD_LS_CELL_SID')] = sid;
t[l10n('CMD_LS_CELL_TITLE')] = title;
t[l10n('CMD_LS_CELL_KEYWORDS')] = keywords.join(', ');
t[l10n('CMD_LS_CELL_UNKEYWORDS')] = unkeywords.join(', ');
t[l10n('CMD_LS_CELL_EPISODEPARSER')] = `${episodeParser}`;
console.log(Table.print(t).trim());
console.log();
const tht = new Table();
sub.threads.forEach((th) => {
tht.cell(l10n('CMD_LS_CELL_THREAD_EPISODE'), th.episode.toString(TheEpisode.ascendCompare));
tht.cell(l10n('CMD_LS_CELL_THREAD_TITLE'), th.title);
tht.newRow();
});
console.log(tht.toString().trim());
console.log();
});
} else {
exports.formatRoutes = routes => { // eslint-disable-line
return Table.print(routes, ({ method, path }, cell) => {
for (const [attr, color, title] of [[method, 'green', 'METHOD'], [path, 'white', 'PATH']]) {
cell(style(title, 'cyan'), style(attr, color)); // eslint-disable-line
}
});
};
_.each(options.table, function(item){ //flatten to an array without links
var exclude = ["links"]
if(_.isArray(options.excludes)){
exclude.push(options.excludes)
}
items.push(_.omit(item[options.key],exclude))
})
}else{
var exclude = ["links"]
if(_.isArray(options.excludes)){
exclude.push(options.excludes)
}
items.push(_.omit(options.table,exclude))
}
data = Table.print(items)
}
if(options.type == "success"){
return console.log("[", "3scale-cli".white, "]", msg.green, data);
}else if(options.type == "error"){
return console.log("[", "3scale-cli".white, "]", msg.red, data);
}else if(options.type == "info"){
}else{
return console.log("[", "3scale-cli".white, "]", msg.cyan, data);
}
} else {
throw new Error("no message defined to print!");
}
}
_.each(options.table, function(item){ //flatten to an array without links
var exclude = ["links"]
if(_.isArray(options.excludes)){
exclude.push(options.excludes)
}
items.push(_.omit(item[options.key],exclude))
})
}else{
var exclude = ["links"]
if(_.isArray(options.excludes)){
exclude.push(options.excludes)
}
items.push(_.omit(options.table,exclude))
}
data = Table.print(items)
}
if(options.type == "success"){
return console.log("[", "3scale-cli".white, "]", msg.green, data);
}else if(options.type == "error"){
return console.log("[", "3scale-cli".white, "]", msg.red, data);
}else if(options.type == "info"){
}else{
return console.log("[", "3scale-cli".white, "]", msg.cyan, data);
}
} else {
throw new Error("no message defined to print!");
}
}
async function text(headerValues: any, items: any) {
const rows: any[] = [];
_.each(items, (item) => {
const row = {};
_.each(headerValues, (headerValue) => {
row[headerValue] = item[headerValue];
});
rows.push(row);
});
console.log(easyTable.print(rows));
}
scope: internals.formatScope(show.scope),
description: internals.formatDescription(show.description)
};
if (!options.showAuth) {
delete row.auth;
}
if (!options.showScope) {
delete row.scope;
}
out.push(row);
});
return Table.print(out);
};
function toTable(array) {
return Table.print(array);
}
writeRows(result) {
result.forEach(this.formatItem.bind(this));
this.log(Table.print(result));
}
}
table(places = 5) {
return Table.print(this.toFixed(places).array);
}