sfp 0.3.5 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  SFP Language Parser
2
2
  ===================
3
3
  - Author: Herry (herry13@gmail.com)
4
- - Version: 0.3.5
4
+ - Version: 0.3.6
5
5
  - License: [BSD License](https://github.com/herry13/sfp-ruby/blob/master/LICENSE)
6
6
 
7
7
  A Ruby gem that provides a Ruby interface to parse [SFP language](https://github.com/herry13/nuri/wiki/SFP-language), a declarative language to specify a planning task.
@@ -23,7 +23,7 @@ Requirements
23
23
  ------------
24
24
  - Ruby (>= 1.8.7)
25
25
  - Rubygems
26
- - antlr3
26
+ - antlr3 (<= 1.8.12)
27
27
  - json
28
28
 
29
29
 
data/bin/sfp CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  libdir = File.expand_path(File.dirname(__FILE__))
4
4
  require "#{libdir}/../lib/sfp"
5
+ require 'yaml'
5
6
 
6
7
  opts = Trollop::options do
7
8
  version "sfp 0.3.5 (c) 2013 Herry"
@@ -12,7 +13,8 @@ Usage:
12
13
  sfp <file>
13
14
  EOS
14
15
 
15
- opt :pretty, "Print the result in pretty JSON format.", :default => false
16
+ opt :pretty, "Print the result in pretty JSON format.", :short => '-r'
17
+ opt :yaml, "Print the result in YAML format.", :short => '-y'
16
18
  end
17
19
 
18
20
  def parse(filepath)
@@ -24,7 +26,11 @@ end
24
26
 
25
27
  filepath = ARGV[0].to_s
26
28
  if filepath != ''
27
- puts parse(filepath).to_json({:pretty => opts[:pretty]})
29
+ if opts[:yaml]
30
+ puts YAML.dump(JSON[parse(filepath).to_json({:pretty => opts[:pretty]})])
31
+ else
32
+ puts parse(filepath).to_json({:pretty => opts[:pretty]})
33
+ end
28
34
  else
29
35
  Trollop::help
30
36
  end