Skip to content

Commit

Permalink
Add tests and more.
Browse files Browse the repository at this point in the history
  • Loading branch information
burningtree committed Apr 6, 2015
1 parent f05564d commit 920267a
Show file tree
Hide file tree
Showing 10 changed files with 523 additions and 285 deletions.
7 changes: 7 additions & 0 deletions .travis.yml
@@ -0,0 +1,7 @@
language: node_js
node_js:
- "0.12"
- "0.11"
- "0.10"
- "iojs"
- "iojs-v1.0.4"
6 changes: 3 additions & 3 deletions README.md
@@ -1,9 +1,9 @@
# μson
μson (uson) is a compact human-readable data serialization format especially designed for shell.

This is initial implementation in node.js. Grammar is written in [PEG](http://en.wikipedia.org/wiki/Parsing_expression_grammar) and parser is generated by [peg.js](http://pegjs.org/).
This is initial implementation written in Javascript and node.js. Grammar is written in [PEG](http://en.wikipedia.org/wiki/Parsing_expression_grammar) and parser is generated by [peg.js](http://pegjs.org/).

Inspiration by python CLI utility [jarg](https://github.com/jdp/jarg) by Justin Poliey (@jdp).
Inspired by python CLI utility [jarg](https://github.com/jdp/jarg) by Justin Poliey (@jdp).

## Example
```
Expand Down Expand Up @@ -45,7 +45,7 @@ or in YAML:
key1:value1 key2:value2 ..
```

Supported is all JSON types:
Supported types (JSON):
* string
* number
* object
Expand Down
6 changes: 4 additions & 2 deletions bin/cli.js
Expand Up @@ -8,8 +8,9 @@ var version = require('../package.json').version;
program
.version(version)
.usage('[options] <input>')
.option('-p, --pretty', 'Pretty print output (only JSON)')
.option('-p, --pretty', 'Pretty print output (only JSONN)')
.option('-y, --yaml', 'Use YAML dialect instead of JSON')
.option('-o, --object', 'Object mode')
.parse(process.argv);

if(program.args.length < 1) {
Expand All @@ -19,7 +20,8 @@ if(program.args.length < 1) {
};

var input = program.args.join(' ');
var output = USON.parse(input);
var options = { mode: program.object ? 'object' : null};
var output = USON.parse(input, options);
var str = null;

if(program.yaml) {
Expand Down

0 comments on commit 920267a

Please sign in to comment.