Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
run() {
const finalConfig = Object.assign({}, this.settings.settings);
delete finalConfig.configs;
delete finalConfig.allConfigs;
delete finalConfig['_'];
this.ui.write(this.cliLogo() + '\n');
this.ui.writeInfo('Config Files');
console.log(prettyjson.render(this.settings.settings.configs, {}, 8));
// this.settings.settings.configs.forEach(configFile => {this.ui.writeInfo(` * ${configFile}`)})
this.ui.writeInfo('Config Data');
console.log(prettyjson.render(finalConfig, {}, 10));
this.ui.writeInfo('Blueprint Paths');
console.log(prettyjson.render(this.settings.blueprints.searchPaths, {}, 8));
this.ui.writeInfo('Blueprints');
console.log(prettyjson.render(this.settings.blueprints.allNames(), {}, 8));
}
}
module.exports.run = (session, args) => {
let help = ''
if (args[0]) {
let command = commands.match(args[0])
if (command) {
if (command.help) {
command.help.legend = {
'': 'Required param',
'[param]': 'Optional param'
}
command.help.alias = command.config.alias
help += prettyjson.render(command.help)
} else {
help = 'Command has not help'
}
} else {
help = 'Command not found'
}
} else {
help = 'Avaiable commands:\n' + commands.list.map(cmd => cmd.config.name)
help += '\n\nFor custom command help type: help command\nExample: help top'
}
console.log(help)
}
cloudrig.validateRequiredConfig(config, function(err) {
if (err) {
console.log("Invalid AWS credentials. Please check your configuration");
configMenu(validateAndSetConfig.bind(null, cb));
} else {
console.log("Setting config");
var displayConfig = Object.assign({}, config);
displayConfig.ParsecServerId = "(set)";
console.log(prettyjson.render(displayConfig, null, 4));
cloudrig.setConfig(config);
cb();
}
});
}
export const printGraphQLError = e => {
const prettyjsonOptions = { keysColor: 'red', dashColor: 'red' }
if (e.response && e.response.errors)
console.error(prettyjson.render(e.response.errors, prettyjsonOptions))
if (e.request) console.error(prettyjson.render(e.request, prettyjsonOptions))
}
exports.print = print = function(options) {
if (options && options.message) {
var data ="";
var msg = "";
if(typeof options.message === "string"){
msg = options.message.toString();
}
if(options.data){
data = prettyjson.render(options.data)
}
if(options.table){
var items = [];
if(_.isArray(options.table)){ //array of objects
_.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)){
module.exports.json = json => process.stdout.write(`${prettyjson.render(json)}\n`);
domainFilter: domain,
truncate,
raw,
}: SearchHandlerOptions): Promise => {
if (!raw) {
spinner.start();
}
try {
const searchData = await search(account, { domain, truncate, userAgent });
const foundData = !!(searchData.breaches || searchData.pastes);
if (foundData && raw) {
logger.log(JSON.stringify(searchData));
} else if (foundData) {
spinner.stop();
logger.log(prettyjson.render(searchData));
} else if (!foundData && !raw) {
spinner.succeed('Good news — no pwnage found!');
}
} catch (err) {
if (!raw) {
spinner.fail(err.message);
} else {
logger.error(err.message);
}
}
};
var printData = function(data, opts) {
var formatted = "";
if (opts.format == "json") {
formatted = JSON.stringify(data);
} else if (opts.format == "pretty") {
formatted = prettyjson.render(data);
}
printLine(formatted);
};
const data = {
'Account name': get(personal, 'name'),
'Account slug': get(personal, 'slug'),
'Account id': get(personal, 'id'),
Name: get(personal, 'billing_name'),
Email: get(personal, 'billing_email')
}
const teamsData = {}
teams.forEach(team => {
return (teamsData[team.name] = team.roles_allowed.join(' '))
})
data.Teams = teamsData
this.log(prettyjson.render(clean(data)))
} else {
this.error(`Not logged in`)
}
}
}
let repositories: Target$[] = key
? registry.find(key)
: registry.repositories.slice();
if (_.isEmpty(repositories))
return info(__("commands.list.log.err_not_found"));
const result: Json$ = registry.toJson(repositories);
const basePath: string = path.join(config.paths.home, config.defaults.base);
const ROOT: string = chalk.white(normalizePath(basePath, options));
!options.nolog &&
process.stdout.write(prettyjson.render({ [ROOT]: result }) + "\n");
return result;
}