Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

cli: turn off beautifier by default

  • Loading branch information...
commit c77f28385e7ade9c4de17459ac37a876c7350b3f 1 parent 94084ba
@indutny indutny authored
Showing with 14 additions and 4 deletions.
  1. +1 −1  GNUmakefile
  2. +7 −1 bin/ometajs2js
  3. +6 −2 lib/ometajs/compiler/ir.js
View
2  GNUmakefile
@@ -3,7 +3,7 @@ SUFFIX=.ometajs
all: lib/ometajs/grammars/bsjs.js
lib/ometajs/grammars/%.js: lib/ometajs/grammars/%.ometajs
- ./bin/ometajs2js --root "../../../" -i $< -o $@
+ ./bin/ometajs2js -b --root "../../../" -i $< -o $@
test:
mocha --ui tdd --growl --reporter spec test/unit/*-test.js
View
8 bin/ometajs2js
@@ -29,8 +29,14 @@ require('coa').Cmd()
.output()
.end()
.opt()
+ .name('beautify').title('Beautify js output (default: false)')
+ .short('b').long('beautify')
+ .def(false)
+ .flag()
+ .end()
+ .opt()
.name('root').title('Path to root module (default: ometajs)')
- .long('root')
+ .short('r').long('root')
.def('ometajs')
.end()
.act(function(options) {
View
8 lib/ometajs/compiler/ir.js
@@ -118,7 +118,7 @@ IR.prototype.optimize = function optimize() {
return this.result.map(traverse);
};
-IR.prototype.render = function render() {
+IR.prototype.render = function render(options) {
var buf = [];
function multibody(nodes, op, fn) {
@@ -281,5 +281,9 @@ IR.prototype.render = function render() {
traverse(node);
});
- return ometajs.utils.beautify(buf.join(''));
+ if (this.options.beautify) {
+ return ometajs.utils.beautify(buf.join(''));
+ } else {
+ return buf.join('');
+ }
};
Please sign in to comment.
Something went wrong with that request. Please try again.