tes/bosco — pull request #43 by cliftonc (2014-12-03 11:51:58+00:00)
Title: Refactor of cmd out to helpers to reduce boilerplate - to discuss

As referenced in issue #41, simple initial refactoring to make defining commands simpler.

Key is an options object you create that contains:

```
{
cmd: 'echo NO COMMAND DEFINED!',
guardFn: function(bosco, repoPath, options, next) {
next();
},
stdoutFn: function(stdout, repoPath) {
bosco.error(repoPath.green + ' >> ' + stdout);
},
stderrFn: function(stderr, repoPath) {
bosco.error(repoPath.red + ' >> ' + stderr);
},
dieOnError: false
}
```

The above are defaults. So as a minimum you can simply supply the text of the command and it will run that across all repos, dumping stderr and stdout as appropriate.

You can then add a guard function (guardFn), this will be called on each repo so you can basically skip the command if this function calls back with an error.

Finally, you can specify stderr and stdout handlers that allow you to style the logging to the console.

For a full example see the refactor of the status command. Open to discussion!