Skip to content

Commit

Permalink
CLI: support for wildcards.
Browse files Browse the repository at this point in the history
Addresses microsoftgh-911.
  • Loading branch information
am11 committed Oct 18, 2014
1 parent ad6203f commit 5fe74be
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
"engines" : {
"node" : ">=0.8.0"
},
"dependencies": {
"glob": "latest"
},
"devDependencies": {
"jake" : "latest",
"mocha" : "latest",
Expand Down
20 changes: 18 additions & 2 deletions src/compiler/commandLineParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module ts {
type: "boolean",
},
{
name: "emitBOM",
name: "emitBOM",
type: "boolean"
},
{
Expand Down Expand Up @@ -197,11 +197,27 @@ module ts {
}
}
else {
filenames.push(s);
testPathsAndPush(s);
}
}
}

function testPathsAndPush(filenameOrPattern: string) {
var fs = require("fs");
var path = require("path");

if (fs.existsSync(path.resolve(process.cwd(), filenameOrPattern))) {
filenames.push(filenameOrPattern);
return;
}

var glob = require("glob");

glob.sync(filenameOrPattern).forEach(function(filename) {
filenames.push(filename);
});
}

function parseResponseFile(filename: string) {
var text = sys.readFile(filename);

Expand Down

0 comments on commit 5fe74be

Please sign in to comment.