aboutsummaryrefslogtreecommitdiff
path: root/lib/getOptions.js
diff options
context:
space:
mode:
authorAnna Henningsen <[email protected]>2015-02-04 01:46:30 +0100
committerAnna Henningsen <[email protected]>2015-12-10 22:14:39 +0100
commit7d9d9a4514c12c80b4c9475d57d674bf775c9149 (patch)
treeb28f1acc9da37a3fa619012906c6c3250aea0654 /lib/getOptions.js
parent3794d16027767014919116bd85a32e3d3de7efa8 (diff)
downloadnode-coveralls-7d9d9a4514c12c80b4c9475d57d674bf775c9149.tar.xz
node-coveralls-7d9d9a4514c12c80b4c9475d57d674bf775c9149.zip
Add command line option to write output to stdout
Adds the command line option pair -w/--write. These options indicate that the output should be written to standard output, rather than being posted to coveralls.io, which may be useful for debugging, mixed-language codebases (e.g. node addons with C++ code) etc.
Diffstat (limited to 'lib/getOptions.js')
-rw-r--r--lib/getOptions.js14
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/getOptions.js b/lib/getOptions.js
index 144d0ad..78f1bf3 100644
--- a/lib/getOptions.js
+++ b/lib/getOptions.js
@@ -129,15 +129,11 @@ var getOptions = function(cb, _userOptions){
getBaseOptions(function(err, options){
// try to get filepath from the command-line
- if (process.argv[2]) {
- if (~['-v', '--verbose'].indexOf(process.argv[2])) {
- if (process.argv[3]) {
- options.filepath = process.argv[3];
- }
- } else {
- options.filepath = process.argv[2];
- }
- }
+ // look into all command line arguments from index 2 which don't start with -
+ var firstNonOptionArgument = process.argv.slice(2).filter(RegExp.prototype.test.bind(/^[^-]/))[0];
+
+ if (firstNonOptionArgument)
+ options.filepath = firstNonOptionArgument;
// lodash or else would be better, but no need for the extra dependency
for (var option in userOptions) {