added `--define` #100

This commit is contained in:
Tobias Koppers 2013-09-24 14:48:08 +02:00
parent 672fc9ba0f
commit 25515b200a
2 changed files with 12 additions and 0 deletions

View File

@ -37,6 +37,8 @@ module.exports = function(optimist) {
.string("records-path").describe("records-path")
.string("define").describe("define")
.string("target").describe("target")
.boolean("cache").describe("cache")

View File

@ -139,6 +139,16 @@ module.exports = function(optimist, argv, convertOptions) {
ensureArray(options.module, "postLoaders");
});
ifArgPair("define", function(name, value) {
if(name === null) {
name = value;
value = true;
}
options.define[name] = value;
}, function() {
ensureObject(options, "define");
});
ifArg("output-path", function(value) {
ensureObject(options, "output");
options.output.path = value;