Example #1
0
function xiterations(){
	var clc = require('cli-color');
console.log(('*************************************************'));
var a, b;
a = 5;
b = 8;
if (a > b || a - b < a) {
console.log('conditional-->a>b || a-b<a');
} else {
console.log('..another');
}
console.log(clc.green.bgWhite('*********************************'));

for (var counter = 0; counter < 10; counter++) {
console.log(counter);
}

console.log(clc.green.bgWhite('*********************************'));
var num = 0;
while (num < 10) {
console.log(num);
num++;
}
console.log(('*************************************************'));
}
Example #2
0
function arithmetic(){
var clc = require('cli-color');
var a, b;
a = 10;
b = 5.4;
console.log('a = 10;b = 5.4;');
console.log(clc.green.bgWhite('*********************************'));

// Addition
var c = a + b;
console.log('a = 10;b = 5.4;');
console.log('c = a + b;');
console.log(clc.green.bgWhite('*********************************'));
console.log(clc.red('addition:c=')+c);

// Subtraction
var c = a - b;
console.log('c = a - b;');
console.log(clc.green.bgWhite('*********************************'));
console.log(clc.green('subtraction:c=')+c);
// Multiplication

var c = a * b;
console.log('c = a * b;');
console.log(clc.green.bgWhite('*********************************'));
console.log(clc.blue('multiplication:c=')+c);

// Division
var c = a / b;
console.log('c = a / b;');
console.log(clc.green.bgWhite('*********************************'));
console.log(clc.black.bgWhite('division:c=')+c);
}
Example #3
0
		}, function (registered) {
			if (registered) {
				logger.log("Registration complete.  " + clc.green.bright("Thank you") + " for using the Game Closure Devkit!");
			} else {
				logger.log(clc.green.bright("Thank you") + " for using the Game Closure Devkit!");
			}
			process.exit(0);
		}).error(function (err) {
Example #4
0
function logCommand(cmd) {
	console.log(clc.blue.bright("> " + cmd.cmd.map(function (piece) { return JSON.stringify(piece); }).join(" ")));

	var stdout = cmd.stdout.replace(/(^\s+|\s+$)/g, '').replace(/\n/g, clc.green.bright("\n || "));
	var stderr = cmd.stderr.replace(/(^\s+|\s+$)/g, '').replace(/\n/g, clc.red.bright("\n || "));

	stdout && console.log(clc.green.bright(" || ") + stdout);
	stderr && console.log(clc.red.bright(" || ") + stderr);
	
	console.log(!cmd.code ? "(exit code 0)" : clc.red.bright("(exit code " + cmd.code + ")"));
}
Example #5
0
 colorTile(t) {
   if (t.length===1) {
     if (t==='c') return colors.redBright.bgWhite('C');
     if (t==='f') return colors.green.bgWhite('F');
     return colors.blueBright.bgWhite(t.toUpperCase());
   }
   if (t.indexOf('b')===0) return colors.green.bgWhite(t.replace('b',''));
   if (t.indexOf('c')===0) return colors.redBright.bgWhite(t.replace('c',''));
   if (t.indexOf('d')===0) return colors.blueBright.bgWhite(t.replace('d',''));
   if (t.indexOf('s')===0) return colors.redBright.bgWhite(t.replace('s',''));
   if (t.indexOf('f')===0) return colors.blueBright.bgWhite(t.replace('f',''));
 }
Example #6
0
        newConfig = function(){ 

        	var props  = [
        			{
        				name: 'host',
        				message: 'Server Hostname'
        			},
        			{
        				name: 'user',
        				message: 'Remote Username'
        			},
        			{
        				name: 'port',
        				message: 'SSH Port'
        			},
        			{
        				name: 'key',
        				message: 'Path to RSA Key'
        			}
        		];

        	console.log(clc.green.bold('WP Freedom CLI Configuration'));

        	prompt.start();

        	prompt.get(props, function (err, result) {
        	  if (err) throw err;
        	  nconf.set('server:host', result.host);
        	  nconf.set('server:user', result.user);
        	  nconf.set('server:port', result.port);
        	  nconf.set('server:key', result.key);
        	  nconf.save();
        	});        	

        };
Example #7
0
function handleBuffer() {
	while (/\n/.test(_buf)) {
		var i = _buf.indexOf('\n');
		var line = _buf.substring(0, i);
		try {
			line = JSON.parse(line);
		} catch (e) {
			console.log(">>", line);
			line = null;
		}

		if (line) {
			if (line.cmd) {
				logCommand(line);
			} else if (line.stdout) {
				console.log("\n" + clc.green.bright(line.stdout) + "\n");
			}

			if (line.diff) {
				
				if (line.diff.code) {
					console.log("diff exited with code", line.diff.code);
					console.log(line.diff.stderr);
				} else {
					var out = path.resolve("basil-release-" + (line.type || Date.now()) + ".patch");
					fs.writeFileSync(out, line.diff.stdout);
					console.log("wrote diff to", out);
				}
			}
		}

		_buf = _buf.substring(i + 1);
	}
}
Example #8
0
function xfunction(){
console.log(clc.green.bgWhite('*********************************'));
console.log(('*************************************************'));
console.log(('*************************************************'));

console.log(('*************************************************'));
}
Example #9
0
File: async.js Project: yandex/ymb
function printResults (cb) {
    console.log(
        '[' + clc.blackBright(moment().format('HH:mm:ss')) +
        '] Stored ' + clc.green.bold(count) + ' asynchronous module(s)'
    );
    cb();
}
Example #10
0
exports.success = function() {
    var args = slice.call(arguments);

    args.unshift(clc.green.bold('[success]'));

    log.apply(this, args);
};
Example #11
0
		}, function (optout) {
			common.config.set("optout", optout === "no", f.wait());

			if (optout) {
				logger.log("Opting-out of sending usage and crash reports.");
			} else {
				//logger.log(clc.yellow.bright("Thanks"), "for helping out by sending usage and crash reports!");
			}

			logger.log("Please " + clc.green.bright("register") + " your product by providing us with your name and email address.  Leave these " + clc.red.bright("blank") + " to opt-out:");

			ask("Name: ", f.slotPlain());
		}, function (name_resp) {
Example #12
0
		compiler.on("end", function (code) {
			err = err.join('').replace(/^stdin:(\d+):/mg, 'Line $1:');
			if (err.length) {
				compressLog.log(clc.green.bright(filename + ':\n') + err);
			}

			if (code == 0) {
				var compressedSrc = out.join('');
				cb(null, compressedSrc);
			} else {
				compressLog.error("exited with code", code);
				cb({'code': code}, src);
			}
		});
Example #13
0
 	fs.readJson(nconf.stores.file.file, function(err, data) {
 	  console.log(clc.green.bold('Current Configuration below.'));
 	  console.dir(data);
 	  prompt.start();
 	  prompt.get([{
 	  	name: 'reconfigure',
 	  	message: 'Do you want to reset wpfree-cli\'s configuration [Y/N]'.red
 	  }], function(err, res){
 	  	if (err) throw err;
 	  	if(res.reconfigure == 'y' || res.reconfigure == 'Y'){
 	  		fs.remove(nconf.stores.file.file, function(err){
 	  			if (err) throw err;
 	  			newConfig();
 	  		});
 	  	}
 	  });
 	});
Example #14
0
		function() {
			var stephook = this;
			var syncPorts = {
				DESC		: "Updating installed ports",
				SHORT_NAME	: "PORTUPDATE",
				hook		: stephook,
				cmd			: {cmd:"port",args:['upgrade','outdated']}
			}
			if(!PORTS_NUM_OUTDATED) {
				hr();
				outlog(clc.green.inverse('SKIP:')+clc.green(' No ports require updating. Yay!'));
				this();
			} else {
				if(options.debug) syncPorts.cmd.args.unshift('-d');
				if(options.dryrun) syncPorts.cmd.args.unshift('-y');
				runProcess(syncPorts);
			}
		},
Example #15
0
Muncher.prototype.buildDir = function(path, context) {
    var that = this;    

    that.echo(clc.bold('Rewriting ' + context));

    that.paths[context].split(',').forEach(function(path) {
        if (fs.lstatSync(path).isDirectory()) {
            var files = glob.sync(path.replace(/\/$/, '') + '/**/*' + that.extensions[context]);

            files.forEach(function(file) {
                that.build(file, context);
            });

        } else if (fs.lstatSync(path).isFile()) {
            that.build(path, context);
        }
    });
    
    that.echo(clc.green.bold('Finished!\n'));
}
exports.ok = function(message) {
    console.log(clc.green.bold('[ OK  ]') + ' ' + message);
}
Example #17
0
var desc = function(description) {
  console.log(color.green.bold(description));
};
Example #18
0
var clc = require('cli-color');
var Bridge = require('./index');
var figures = require('figures');
var credentials = require('./credentials');

var valid = clc.green.bold(figures.tick);
var bad = clc.red.bold(figures.cross);

var brooklyn = new Bridge();

var options = {
	delay: process.argv[2] || 15,
	priority: [],
	filter: function(fp) {
		return true;
	}
};

credentials['auto-refresh'] = true;
brooklyn.loginToApi(credentials, function(err) {
	if (err) {
		console.error(err.toString());
		process.exit(1);
	}
});

brooklyn.on('login', function() {
	console.log(valid, clc.green('Login!'));
	brooklyn.automatic(options);
});
Example #19
0
		var f = ff(function () {
			logger.log(clc.yellow("By default basil will send anonymous usage and crash reports"));
			logger.log(clc.yellow("to help us improve the DevKit."));

			ask("Press " + clc.green.bright("enter") + " to continue.  Or type \"" + clc.red.bright("no") + "\" to opt-out: ", f.slotPlain());
		}, function (optout) {
Example #20
0
 logSuccess: function () {
   console.log(cli.green.apply(this, arguments));
 },
Example #21
0
//commandline interface
//parses args and passes them into buid
function exec (args, config, next) {
	var Optimist = require('optimist');

	var optimistParser = new Optimist(args)
		.boolean('debug')
			.default('debug', config.template !== "release")
			.describe('debug', '[native] builds a version with debugging support')

		.boolean('compress')
			.default('compress', config.template !== "debug")
			.describe('compress', '[js] minifies JavaScript files')
		
		.boolean('stage')
			.default('stage', false)
			.describe('stage', '[server] use the staging server')

		.boolean('serverDebug')
			.default('serverDebug', false)
			.describe('serverDebug', '[server] internal use only')

		.string('servicesURL')
			.describe('servicesURL', '[server] internal use only')

		.string('outputDir')
			.alias('outputDir', 'o')
			.describe('outputDir', '[sdk] ')

		.boolean('isSimulated')
			.default('isSimulated', false)
			.describe('isSimulated', '[sdk] internal use only')

		.usage('Usage: ' + clc.green.bright('basil build') + clc.yellow.bright(' [target]\n\n')
			+ 'where ' + clc.yellow.bright('[target]') + ' is one of:\n\n'
			+ '\t' + targetNames.join('\n\t'));

	var argv = optimistParser.argv;
	var target = argv._[0] && argv._[0].toLowerCase();
	if (!target || targetNames.indexOf(target) == -1) {

		if (!target) {
			logger.error('no target provided\n');
		} else {
			logger.error('"' + clc.yellow.bright(target) + '" is not a valid target\n');
		}

		optimistParser.showHelp();
		next && next();
		return;
	}

	common.startTime('build');

	argv.template = config.template;

	build('.', target, argv, function (failed) {
		
		if (!failed) {
			logger.log('\nFinished building.');
			common.endTime('build');
		}

		jvmtools.stop(next || function () { });
		if(next) next(failed);
		else process.exit(failed ? 2 : 0);
	});
}
Example #22
0
File: print.js Project: itkoren/fur
exports.ok = function (msg) {
    msg = color.green.bold(join(arguments));
    exports(msg);
};