How to use the cliff.inspect function in cliff

To help you get started, we’ve selected a few cliff examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github taskcluster / taskcluster / clients / client / bin / update-apis.js View on Github external
.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));
  });
github DeviaVir / zenbot / commands / trade.js View on Github external
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) {
github beaugunderson / ip-address / bin / ipv6.js View on Github external
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']));
  }
});
github aredotna / ervell / node_modules / forever / lib / forever / cli.js View on Github external
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);
  });
});
github foreversd / forever / lib / forever / cli.js View on Github external
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);
  });
});
github ezpaarse-project / ezpaarse / node_modules / forever / lib / forever / cli.js View on Github external
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);
  });
});
github node-pinus / pinus / tools / pinus-cli / lib / commands / _config.ts View on Github external
}, function (err: Error, data: object) {
                if (err) console.log(err);
                else util.log('\n' + cliff.inspect(data) + '\n');
                rl.prompt();
            });
    }
github NetEase / pomelo-cli / lib / commands / _config.js View on Github external
}, function(err, data) {
		if (err) console.log(err);
		else util.log('\n' + cliff.inspect(data) + '\n');
		rl.prompt();
	});
}
github NetEase / pomelo-cli / lib / util.js View on Github external
var msg = data.msg;
		var server = msg.body;
		var rows = [];
		rows.push(['time', 'serverId', 'serverType', 'pid', 'cpuAvg', 'memAvg', 'vsz', 'rss', 'usr', 'sys', 'gue']);
		var color = getColor(rows[0].length);
		if (server) {
			rows.push([server['time'], server['serverId'], server['serverType'], server['pid'], server['cpuAvg'], server['memAvg'], server['vsz'], server['rss'], server['usr'], server['sys'], server['gue']]);
			log('\n' + cliff.stringifyRows(rows, color) + '\n');
		} else {
			log('\n' + consts.STATUS_ERROR + '\n');
		}
		return;
	}

	if (comd === 'config' || comd === 'components' || comd === 'settings' || comd === 'get' || comd === 'set' || comd === 'exec' || comd === 'run') {
		log('\n' + cliff.inspect(data) + '\n');
		return;
	}

	if (comd === 'stop') {
		return
	}

	if (comd === 'add') {
		return
	}

	if (comd === 'proxy' || comd === 'handler') {
		log('\n' + cliff.inspect(data) + '\n');
		return
	}
github node-pinus / pinus / tools / pinus-cli / lib / util.ts View on Github external
if (comd === 'config' || comd === 'components' || comd === 'settings' || comd === 'get' || comd === 'set' || comd === 'exec' || comd === 'run') {
        log('\n' + cliff.inspect(data) + '\n');
        return;
    }

    if (comd === 'stop') {
        return;
    }

    if (comd === 'add') {
        return;
    }

    if (comd === 'proxy' || comd === 'handler') {
        log('\n' + cliff.inspect(data) + '\n');
        return;
    }

    if (comd === 'memory' || comd === 'cpu') {
        log(data + '\n');
        return;
    }
}

cliff

Your CLI formatting friend.

MIT
Latest version published 10 years ago

Package Health Score

56 / 100
Full package analysis