<commit_before>var io = require('socket.io-client');

var Parser = require('commandline-parser').Parser;

var parser = new Parser({
        name : "mgrid-client",
        desc : 'Mobile grid client',
        extra : 'This command helps you to connect a new device to mobile grid for execution'
    });

parser.addArgument('config' ,{
    flags : ['c','config'], 
    desc : "Specify configuration file",
    action : run
});

parser.addArgument('c', 'Specify configuration file');
parser.exec();

function run(value, parser){
	var config = require(parser.get('c') || './config.json');
	var socket = io.connect(config.serverUrl);
	var testexecution = require('./testexecution');


	 socket.on('connect', function(){
	 	console.log("Connecting Device");
	 	socket.emit('deviceInfo', config.device);

	 	socket.on("execute",function(data){
	 		console.log("Running tests.......");
	 		socket.emit("status",{runitem: data.runitem,status: 'Running'})
	 		testexecution.run(socket,data.runitem.id,config);
	 	});
	    
	    socket.on('disconnect', function(){<commit_msg>Fixed: execute with default config if no command option specified<commit_after>var io = require('socket.io-client');

var Parser = require('commandline-parser').Parser;

var parser = new Parser({
        name : "mgrid-client",
        desc : 'Mobile grid client',
        extra : 'This command helps you to connect a new device to mobile grid for execution'
    });

parser.addArgument('config' ,{
    flags : ['c','config'], 
    desc : "Specify configuration file",
});

parser.exec();

if(parser.get("help")){
	process.exit(0);
}

run(parser);

function run( parser){
	var config = require(parser.get('config') || './config.json');
	var socket = io.connect(config.serverUrl);
	var testexecution = require('./testexecution');


	 socket.on('connect', function(){
	 	console.log("Connecting Device");
	 	socket.emit('deviceInfo', config.device);

	 	socket.on("execute",function(data){
	 		console.log("Running tests.......");
	 		socket.emit("status",{runitem: data.runitem,status: 'Running'})
	 		testexecution.run(socket,data.runitem.id,config);
	 	});
	    
	    socket.on('disconnect', function(){
{'fraction_non_alphanumeric': 0.17158671586715868, 'fraction_numerical': 0.00046125461254612545, 'mean_word_length': 4.009237875288684, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2379742', 'n_tokens_mistral': 685, 'n_tokens_neox': 640, 'n_words': 151}