<commit_before>#!/usr/bin/env node

var cli = require('cli').enable('status');
require('sexylog');

var amqpUrl = process.env.MUON_URL;


cli.parse({
    discover:   ['d', 'discover muon services'],
    rpc:  ['rpc', 'remote procedure call url', 'string'],
    stream: ['s', 'print events from stream', 'string']
});
 
cli.main(function(args, options) {

 
    this.ok('muon cli connected: ' + amqpUrl);
 
    this.ok('options: ' + JSON.stringify(options));

    if (options.discover) {
        discover();
    }

});


function discover() {

    var AmqpDiscovery = require("../../muon/discovery/amqp/amqp-discovery");
    var discovery = new AmqpDiscovery(amqpUrl);

    setTimeout(function() {
            discovery.discoverServices(function(services) {
                    console.log('services: ' + JSON.stringify(services));
                    exit();
             });
    }, 5000)


}



function exit() {
    process.exit(0);
}<commit_msg>added cli error help message<commit_after>#!/usr/bin/env node

var cli = require('cli').enable('status');
require('sexylog');
var url = require('url');
var Joi = require('joi');




var amqpUrl = process.env.MUON_URL;


cli.parse({
    discover:   ['d', 'discover muon services'],
    rpc:  ['rpc', 'remote procedure call url', 'string'],
    stream: ['s', 'print events from stream', 'string']
});
 
cli.main(function(args, options) {

    var validAmqpUrl =  Joi.validate(amqpUrl,  Joi.string().uri().required());

    if (validAmqpUrl.error) {
        logger.error('amqp env variable url invalid! MUON_URL=' + amqpUrl);
        exit();
    }
    this.ok('muon cli connected: ' + amqpUrl);
 
    this.ok('options: ' + JSON.stringify(options));

    if (options.discover) {
        discover();
    }

});


function discover() {

    var AmqpDiscovery = require("../../muon/discovery/amqp/amqp-discovery");
    var discovery = new AmqpDiscovery(amqpUrl);

    setTimeout(function() {
            discovery.discoverServices(function(services) {
                    console.log('services: ' + JSON.stringify(services));
                    exit();
             });
    }, 5000)


}

var validate = function(err, value) {
    logger.info(err);


    if (err) {
        logger.error(value);
        exit();
    }
}

function exit() {
    process.exit(0);
}
{'fraction_non_alphanumeric': 0.16992611907866145, 'fraction_numerical': 0.004345936549326379, 'mean_word_length': 2.7249190938511325, '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': '4585147', 'n_tokens_mistral': 767, 'n_tokens_neox': 718, 'n_words': 149}