UNPKG

phpmetrix

Version:

phpmetrix for Node.js is a wrapper around phpmetrics that allows for integration with build systems like Grunt, Gulp and more!

38 lines (30 loc) 810 B
#!/usr/bin/env node var exec = require('child_process').exec var args = process.argv.slice(2) var cli = require('./').cli var suppress = false if (args.length === 0 || (args.length === 1 && args[0] === 'help')) { console.log([ '', ' Usage: phpmetrix path/to/config.yml', '', ' Examples:', ' phpmetrix config.yml', '' ].join('\n')) } if (args[0] === '-v' || args[0] === '--version') { var pkg = require('./package.json') console.log(pkg.version) process.exit() } if (args.indexOf('-s') !== -1 || args.indexOf('--suppress') !== -1) { suppress = false } exec('php -v', function (err, stdout, stderr) { if (err) throw new Error(err) }) exec('phpmetrics --version', function (err, stdout, stderr) { if (err) throw new Error(err) }) cli(args, {suppress: suppress});