Skip to content

Commit

Permalink
(new api) '-m' matches a string, changes -R to -r
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudhead committed Jun 11, 2010
1 parent 25abf72 commit 4b92fa4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion bin/vows
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,14 @@ while (arg = argv.shift()) {
} else {
arg = arg.match(/^--?(.+)/)[1];

if (arg[0] === 'R') {
if (arg[0] === 'r') {
options.matcher = new(RegExp)(arg.slice(1));
} else if (arg[0] === 'm') {
options.matcher = (function (str) { // Create an escaped RegExp
var specials = '. * + ? | ( ) [ ] { } \\ ^ ? ! = : $'.split(' ').join('|\\'),
regex = new(RegExp)('(\\' + specials + ')', 'g');
return new(RegExp)(str.replace(regex, '\\$1'));
})(arg.slice(1));
} else if (arg in options) {
options[arg] = true;
} else {
Expand Down

0 comments on commit 4b92fa4

Please sign in to comment.