How to use the cli.debug function in cli

To help you get started, we’ve selected a few cli 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 beaugunderson / ip-address / bin / ipv6grep.js View on Github external
grepArguments.push(regex);
    stdin = true;
  } else if (args.length > 1) {
    // filename
    address = new v6.Address(new v6.Address(args[0]).correctForm());
    regex = address.regularExpressionString(options.substring);

    var files = args.slice(1, args.length);

    cli.debug('address: ' + util.inspect(address.regularExpression()));
    cli.debug('files: ' + util.inspect(files));

    grepArguments = grepArguments.concat(regex, files);
  }

  cli.debug('grep arguments: ' + util.inspect(grepArguments));

  if (!stdin) {
    var grep = spawn('grep', grepArguments);

    grep.stdout.on('data', function (data) {
      console.log(String(data).trim());
    });

    grep.stderr.on('data', function (data) {
      cli.debug(String(data).trim());
    });

    grep.on('exit', function (code) {
      cli.debug('grep exited: ' + code);
    });
  }
github jessfraz / dstats / index.js View on Github external
parse(function(containers) {
    if (containers.length <= 0){
        return cli.error("No containers.")
    }

    cli.debug("Got containers: " + containers);
    
    // create the grid
    var grid;
    if (containers.length >= 1) {
        grid = new contrib.grid({rows: 1, cols: 1})
    } else {
        grid = new contrib.grid({rows: Math.ceil(containers.length/2), cols: 2});
    }

    // get the stats for the containers
    containers.forEach(function(el, i){
        grid.set(0, 0, contrib.line, {
            style: {
                line: "yellow",
                text: "green", 
                baseline: "black"
github 321hendrik / timagic / lib / main.js View on Github external
'remove': {
						indicatorString: 'Removing app from connected devices',
						showNotification: true
					}
				};

				var indicatorString = methodStrings[cli.command].indicatorString;
				if (indicatorString) {
					cli.spinner(indicatorString + '...');
				}

				var showNotification = methodStrings[cli.command].showNotification;

				var singleLog = methodStrings[cli.command].singleLog;
				if (singleLog) {
					cli.debug(singleLog);
				}

				logic[cli.command](env, settings, tiapp, params)
					.then(function (data) {
						if (indicatorString) {
							var ms = new Date().getTime() - perf;
							x = ms / 1000;
							seconds = Math.round(x % 60);
							x /= 60;
							minutes = Math.round(x % 60);
							cli.spinner(indicatorString + '...done! (' + minutes + 'm '+seconds+'s)', true);
						}
						// show a system notification
						if (settings['enable_notifications'] && showNotification) {
							cli.exec('which osascript', function (data) {
								var notificationTitle = 'TiMagic Success';
github simontabor / serenity / regenerate.js View on Github external
fs.remove('./_site',function() {
    cli.debug('Deleted ./_site');
    fs.mkdir('./_site',function() {
     cli.debug('Created ./_site');
      for (var i = 0; i< files.length; i++) {
        var path = files[i].substr(1,files[i].length);
        var patharr = files[i].substr(2,files[i].length).split('/');
        if (patharr[0].substr(0,1) == '_') continue;
        var filename = patharr[patharr.length -1];

        for (var j=0;j
github simontabor / serenity / lib / regenerate.js View on Github external
fs.remove('./_site',function() {
    cli.debug('Deleted ./_site');

    fs.mkdir('./_site',function() {
     cli.debug('Created ./_site');
      for (var i = 0; i< files.length; i++) {
        var path = files[i].substr(1,files[i].length);
        var patharr = files[i].substr(2,files[i].length).split('/');
        if (patharr[0].substr(0,1) == '_') continue;
        var filename = patharr.pop();
        fs.mkdirs('./_site/'+patharr.join('/')+'/',function(file,pathy,err) {
          if (err) cli.error('error making dir ' + err);
          read(file,pathy);
        }.bind(this,files[i],path));
      }
    });
  });
};
github simontabor / serenity / lib / Serenity.js View on Github external
function error(err) {
    cli.debug('error serving '+req.url + ' ' +err.status);
    res.statusCode = err.status || 500;
    res.end(err.message);
  }
github simontabor / serenity / convert.js View on Github external
fs.writeFile('./templr.js', 'var config = '+JSON.stringify(json,null,2)+';\n\nmodule.exports=config;', function (err) {
            if (err) return cli.error(err);
            cli.debug('Converted and saved config');
          });
        });
github simontabor / serenity / serenity.js View on Github external
var app = http.createServer(function(req, res){
      cli.debug(req.method + ' ' + req.url);
      function error(err) {
        cli.debug('error serving '+req.url + ' ' +err.status);
        res.statusCode = err.status || 500;
        res.end(err.message);
      }

      function redirect() {
        var u = url.parse(req.url);
        var loc = u.pathname + '/' + (u.search || '');
        res.statusCode = 301;
        res.setHeader('Location', loc);
        res.end('Redirecting to ' + loc);
      }

      send(req, url.parse(req.url).pathname)
      .root(root+'/_site')
github MM56 / mm-packer / index.js View on Github external
function printDebug(msg) {
	if(debug) {
		cli.debug(msg);
	}
}
github beaugunderson / ip-address / bin / ipv6grep.js View on Github external
grep.stderr.on('data', function (data) {
      cli.debug(String(data).trim());
    });