aboutsummaryrefslogtreecommitdiff
path: root/lib/sendToCoveralls.js
diff options
context:
space:
mode:
authorAnna Henningsen <[email protected]>2015-04-15 17:11:10 +0200
committerAnna Henningsen <[email protected]>2015-12-10 22:14:42 +0100
commitbe2f7b8407e84bd3db1c3d30b2a0b225c9faaf15 (patch)
tree1fd3ed200472f5b6c19123ecf3b04aa6b837d869 /lib/sendToCoveralls.js
parent879fb9e850ef569c37dd255059f0e63b6029281a (diff)
downloadnode-coveralls-be2f7b8407e84bd3db1c3d30b2a0b225c9faaf15.tar.xz
node-coveralls-be2f7b8407e84bd3db1c3d30b2a0b225c9faaf15.zip
Use minimist to parse command line options
The command line options are made available as a object via `index.options`
Diffstat (limited to 'lib/sendToCoveralls.js')
-rw-r--r--lib/sendToCoveralls.js9
1 files changed, 2 insertions, 7 deletions
diff --git a/lib/sendToCoveralls.js b/lib/sendToCoveralls.js
index 9606a08..fcf63a8 100644
--- a/lib/sendToCoveralls.js
+++ b/lib/sendToCoveralls.js
@@ -1,4 +1,5 @@
var request = require('request');
+var index = require('../index');
var sendToCoveralls = function(obj, cb){
var urlBase = 'https://coveralls.io';
@@ -9,7 +10,7 @@ var sendToCoveralls = function(obj, cb){
var str = JSON.stringify(obj);
var url = urlBase + '/api/v1/jobs';
- if (hasWriteToStdoutOption()) {
+ if (index.options.stdout) {
process.stdout.write(str);
cb(null, { statusCode: 200 }, '');
} else {
@@ -19,10 +20,4 @@ var sendToCoveralls = function(obj, cb){
}
};
-function hasWriteToStdoutOption(){
- // look into command line arguments starting from index 2
- return process.argv.slice(2).filter(RegExp.prototype.test.bind(/^(-s|--stdout)$/)).length > 0;
-}
-
-
module.exports = sendToCoveralls;