all files / label/ index.js

100% Statements 11/11
100% Branches 6/6
100% Functions 1/1
100% Lines 11/11
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51                                                                               
/*
    ___ usage ___ en_US ___
    usage: prolific syslog <options>
 
        -a, --application <string>
            The application name to display in the syslog record. Defaults to
            the value of `process.title` which will always be `node`.
 
        -h, --hostname <string>
            The hostname to display in the syslog record. Defaults to the value
            of `require('os').hostname()`.
 
        -f, --facility <string>
            The syslog facility to encode in the syslog record. Defaults to `local0`.
 
        -p, --pid <string>
            The process id to display in the syslog record. Defaults to
            the value of `process.pid`.
 
        -s, --serializer <string>
            The type of serializer for the payload. Defaults to "json".
 
            --help                      display this message
 
    ___ $ ___ en_US ___
 
    ___ . ___
*/
 
require('arguable')(module, require('cadence')(function (async, program) {
    program.helpIf(program.ultimate.help)
    var argv = program.argv.slice(), terminal = program.terminal, labels = []
    if (argv.length) {
        while (argv.length && ~argv[0].indexOf('=')) {
            var $ = /^([^=]+)=(.*)$/.exec(argv.shift())
            labels.push({ name: $[1], value: $[2] })
        }
        if (terminal = argv[0] == '--') {
            argv.shift()
        }
    }
    return  {
        moduleName: 'prolific/label/label.processor',
        parameters: { labels: labels },
        argv: argv,
        terminal: terminal
    }
}))
 
module.exports.isProlific = true