so-pretty 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ebcbc2fa619e3b9d8456f1173803b48896bb0244
4
- data.tar.gz: 9156649bc47e57c81af01f411813c1f14b6e16b0
3
+ metadata.gz: 100ba0b3c6d2d72a42f55e3d7aa5e06b6f61dce9
4
+ data.tar.gz: 6ad553a0192ab14995e306cff44a9ce7bf80be58
5
5
  SHA512:
6
- metadata.gz: 213252e82e13d776c79c19b2c4c2a4c2a451adce5aaaf9eeac2a0547b5f161443464a3b3fa3a142cdc684c3ac3dcae21e364af56eca5043d8e6d9b6003800e2d
7
- data.tar.gz: a17ad9329dd6218fb7ec7bfa5e6c23f1d834e73368bbbfc39a5a173fe2809f3decd04c09a70f745b27e560f2f95a39e66750945e67edf9c4f2997b8a53d54471
6
+ metadata.gz: 4883640bcf017232553c3036dc0645dc254329fffd4a464b790bc25a5140128e2f06345c0e5feb7c4211a74a6ae76e4106f4a0d515637d7683968e24fb86912e
7
+ data.tar.gz: 679699610a7bf11bdf3854758afb52cfece142ddf1176f709c1dc22c4fb26e77cd630d23a13ef14fbc46a0a551aa5560d8767989e09c861f8856e26792c9a9ed
data/README.md CHANGED
@@ -13,3 +13,22 @@ Usage: sp [options]
13
13
  * csv
14
14
  * toml
15
15
  * some specs would be nice
16
+
17
+ ## Examples
18
+
19
+ $ echo '{"foo":"bar"}' | sp -f ruby
20
+ > {
21
+ > "foo" => "bar"
22
+ > }
23
+
24
+ $ echo '{"foo":"bar"}' | sp -f json
25
+ > {
26
+ > "foo": "bar"
27
+ > }
28
+
29
+ $ echo '{"foo":"bar"}' | sp -f yaml
30
+ > ---
31
+ > foo: bar
32
+
33
+ $ echo '{"foo":"bar"}' | sp -f minjson
34
+ > {"foo":"bar"}
@@ -5,6 +5,7 @@ require 'json'
5
5
  require 'zlib'
6
6
  require 'yaml'
7
7
  require 'optparse'
8
+ require 'so-pretty/version'
8
9
 
9
10
  begin
10
11
  require 'awesome_print'
@@ -105,18 +106,29 @@ module SoPretty
105
106
 
106
107
  parser = OptionParser.new do |opts|
107
108
  opts.banner = "Usage: sp [options]"
109
+ opts.separator ""
110
+ opts.separator "Options:"
108
111
 
109
- opts.on( "-i", "--input [instream]", "Input stream, one of: '-', 'STDIN', or a file name" ) do |instream|
112
+ opts.on( "-i", "--input [instream]", "Input stream, one of: '-', 'STDIN', or a file name. default: '-'" ) do |instream|
110
113
  options[:instream] = instream
111
114
  end
112
115
 
113
- opts.on( "-o", "--output [outstream]", "Output stream, one of: '-', 'STDOUT', 'STDERR' or a file name" ) do |outstream|
116
+ opts.on( "-o", "--output [outstream]", "Output stream, one of: '-', 'STDOUT', 'STDERR' or a file name. default: '-'" ) do |outstream|
114
117
  options[:outstream] = outstream
115
118
  end
116
119
 
117
120
  opts.on( "-f", "--format [format]", "Output format, one of: 'yaml', 'json', 'ruby', 'minjson'") do |format|
118
121
  options[:format] = format.to_sym
119
122
  end
123
+
124
+ opts.on("-V", "--version", "Show version") do
125
+ puts VERSION
126
+ exit
127
+ end
128
+
129
+ opts.separator ""
130
+ opts.separator "Examples:"
131
+ opts.separator EXAMPLES
120
132
  end
121
133
 
122
134
  parser.parse( argv )
@@ -150,4 +162,23 @@ module SoPretty
150
162
  return File.open( maybe_stream, mode )
151
163
  end
152
164
  end
165
+
166
+ EXAMPLES=<<EOD
167
+ $ echo '{"foo":"bar"}' | sp -f ruby
168
+ > {
169
+ > "foo" => "bar"
170
+ > }
171
+
172
+ $ echo '{"foo":"bar"}' | sp -f json
173
+ > {
174
+ > "foo": "bar"
175
+ > }
176
+
177
+ $ echo '{"foo":"bar"}' | sp -f yaml
178
+ > ---
179
+ > foo: bar
180
+
181
+ $ echo '{"foo":"bar"}' | sp -f minjson
182
+ > {"foo":"bar"}
183
+ EOD
153
184
  end
@@ -1,3 +1,3 @@
1
1
  module SoPretty
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: so-pretty
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Nakashima