all files / prolific.monitor/ programmatic.js

92.86% Statements 13/14
90% Branches 9/10
100% Functions 2/2
92.86% Lines 13/14
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23                    
module.exports = function (program, terminal, argv) {
    if (argv.length == 0) {
        program.abend('no program')
    }
    return terminal || !/(^[\w.]+$|^[\w.]+:)/.test(argv[0]) || argv[0] == 'node' || (function () {
        try {
            var command = argv[0]
            if (~command.indexOf(':')) {
                argv.shift()
                argv.unshift(command.split(':')[0], '--url', command)
            }
            command = argv[0]
            Iif (command[0] == '@') {
                return ! require(command[0].substring(1))
            } else {
                return ! require('prolific.' + command + '/__prolific__').isProlific
            }
        } catch (e) {
            return true
        }
    })()
}