-
Notifications
You must be signed in to change notification settings - Fork 258
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use minimist to parse command line options
The command line options are made available as a object via `index.options`
- Loading branch information
Showing
4 changed files
with
16 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,16 @@ | ||
var index = require('../index'); | ||
|
||
module.exports = function(){ | ||
return require('log-driver')({level : getLogLevel()}); | ||
}; | ||
|
||
function getLogLevel(){ | ||
if (hasVerboseCommandLineOption() || hasDebugEnvVariable()) { | ||
if (index.options.verbose || hasDebugEnvVariable()) { | ||
return 'warn'; | ||
} | ||
return 'error'; | ||
} | ||
|
||
function hasVerboseCommandLineOption(){ | ||
// look into command line arguments starting from index 2 | ||
return process.argv.slice(2).filter(RegExp.prototype.test.bind(/^(-v|--verbose)$/)).length > 0; | ||
} | ||
|
||
function hasDebugEnvVariable(){ | ||
return process.env.NODE_COVERALLS_DEBUG == 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters