Permalink
Browse files

Support JS object formatting, at least the prefixes

  • Loading branch information...
1 parent 206cef8 commit 59e2fb4a87b27dbcc0097ff971561695e6067fd2 @jhs committed Feb 26, 2011
Showing with 9 additions and 2 deletions.
  1. +9 −2 cli.js
View
11 cli.js
@@ -8,8 +8,8 @@ var sys = require('sys')
;
var usage = 'jss <test predicate> [result expression]';
-var argv = require('optimist')
- .boolean(['bulk_docs', 'bulk-docs'])
+var argv = require('optimist').boolean(['bulk_docs', 'bulk-docs'])
+ .boolean(['object'])
.argv
, predicate = argv._[0]
, expression = argv._[1]
@@ -74,6 +74,13 @@ if(argv.bulk_docs || argv['bulk-docs']) {
stream.pre = function() { return ", " };
return "[ ";
}
+} else if(argv.object) {
+ argv.tail = '}';
+
+ stream.pre = function() {
+ stream.pre = function() { return ", " };
+ return '{ ';
+ }
}
; ['pre', 'suf', 'head', 'tail'].forEach(function(arg) {

0 comments on commit 59e2fb4

Please sign in to comment.