Skip to content

Commit

Permalink
support no grunt configuration, and specifying args via command line
Browse files Browse the repository at this point in the history
  • Loading branch information
pwmckenna committed Jun 7, 2013
1 parent 97b8803 commit 6170fb5
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions tasks/bunyan.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,27 @@ module.exports = function (grunt) {
var stdoutWrite = process.stdout.write;
var conditions = [];
grunt.registerTask('bunyan', function () {
var options = grunt.config('bunyan');
var names = this.args;
var options = grunt.config('bunyan') || {};
var args = [];

if (options.strict) {
var strict = options.strict || grunt.option('strict');
if (strict) {
args.push('--strict');
}

if (options.level) {
var level = options.level || grunt.option('level');
if (level) {
args.push('--level');
args.push(options.level);
args.push(level);
}

if (options.output) {
var output = options.output || grunt.option('output');
if (output) {
args.push('--output');
args.push(options.output);
args.push(output);
}

var names = this.args;
if (names) {
_.each(names, function (name) {
conditions.push('this.name === ' + JSON.stringify(name));
Expand Down

0 comments on commit 6170fb5

Please sign in to comment.