ppcommand 0.1.3 → 0.1.4

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.
data/README.rdoc CHANGED
@@ -22,22 +22,66 @@ Parse and pp YAML/JSON/XML/CSV/HTML.
22
22
 
23
23
  Parse YAML and pp.
24
24
 
25
- pp ./config/database.yml
25
+ $ pp ./config/database.yml
26
+ {"development"=>
27
+ {"encoding"=>"utf8",
28
+ "username"=>"root",
29
+ "adapter"=>"mysql",
30
+ "host"=>"localhost",
31
+ "password"=>nil,
32
+ "database"=>"appname_test",
33
+ "pool"=>5},
34
+ :
26
35
 
27
36
  Parse JSON and pp.
28
37
 
29
- pp http://api.twitter.com/1/statuses/public_timeline.json
38
+ $ pp http://api.twitter.com/1/statuses/public_timeline.json
39
+ [{"user"=>
40
+ {"name"=>"septiasabatina",
41
+ "profile_sidebar_fill_color"=>"FFFFFF",
42
+ "profile_sidebar_border_color"=>"FFFFFF",
43
+ "profile_background_tile"=>true,
44
+ "profile_link_color"=>"000000",
45
+ "url"=>"http://example.com",
46
+ "contributors_enabled"=>false,
47
+ "favourites_count"=>0,
48
+ "id"=>123456789,
49
+ "description"=>"",
50
+ "utc_offset"=>0,
51
+ "lang"=>"en",
52
+ :
30
53
 
31
54
  Parse HTML and pp (required nokogiri).
32
55
 
33
- pp http://www.google.com/
34
-
35
- Get URL contents as text, skip 1 line, convert encoding to UTF-8, parse CSV and pp with labels.
36
-
37
- pp -t http://example.com/example.csv | head -n +1 | nkf -w | pp -C
38
-
39
-
40
- == Note on Patches/Pull Requests
56
+ $ pp http://www.google.com/
57
+ #(Document:0x96c0ee {
58
+ name = "document",
59
+ children = [
60
+ #(DTD:0x96bb9e { name = "html" }),
61
+ #(Element:0x96b5cc {
62
+ name = "html",
63
+ children = [
64
+ #(Element:0x96adb6 {
65
+ name = "head",
66
+ :
67
+
68
+ Get URL contents as text, skip 3 line, convert encoding to UTF-8, parse CSV and pp with labels. When using --csvtable(-C), the first line treated as label.
69
+
70
+ $ pp -t http://example.com/items.csv | head -n +3 | nkf -w | pp -C
71
+ [[[0, "name", "apple"],
72
+ [1, "price", "100"],
73
+ [2, "amount", "99"],
74
+ [3, "label1", "aaa"],
75
+ [4, "label2", "bbb"],
76
+ [5, "label3", "ccc"]],
77
+ [[0, "name", "orange"],
78
+ [1, "price", "123"],
79
+ [2, "amount", "10"],
80
+ [3, "label1", "xxx"],
81
+ [4, "label2", "yyy"],
82
+ [5, "label3", "zzz"]]]
83
+
84
+ == Note on Patches/Pull Requests
41
85
 
42
86
  * Fork the project.
43
87
  * Make your feature addition or bug fix.
data/Rakefile CHANGED
@@ -5,8 +5,8 @@ begin
5
5
  require 'jeweler'
6
6
  Jeweler::Tasks.new do |gem|
7
7
  gem.name = "ppcommand"
8
- gem.summary = %Q{pretty print YAML/JSON/XML}
9
- gem.description = %Q{pretty print YAML/JSON/XML}
8
+ gem.summary = %Q{Parse and pp YAML/JSON/XML/CSV/HTML}
9
+ gem.description = %Q{Parse and pp YAML/JSON/XML/CSV/HTML}
10
10
  gem.email = "koseki@gmail.com"
11
11
  gem.homepage = "http://github.com/koseki/ppcommand"
12
12
  gem.authors = ["KOSEKI Kengo"]
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.4
data/lib/ppcommand.rb CHANGED
@@ -39,7 +39,7 @@ class PPCommand
39
39
  pp CSV.parse(source)
40
40
  end
41
41
 
42
- def pp_csv2(source)
42
+ def pp_csvtable(source)
43
43
  require 'csv'
44
44
  data = CSV.parse(source)
45
45
  keys = data.shift
@@ -89,7 +89,7 @@ class PPCommand
89
89
  end
90
90
 
91
91
  opp.on("-c", "--csv", "parse CSV and pp."){|x| opts[:type] = "csv"}
92
- opp.on("-C", "--csvtable", "parse CSV, add labels and pp."){|x| opts[:type] = "csvhash"}
92
+ opp.on("-C", "--csvtable", "parse CSV, add labels and pp."){|x| opts[:type] = "csvtable"}
93
93
  opp.on("-H", "--html", "parse HTML and pp."){|x| opts[:type] = "html"}
94
94
  opp.on("-j", "--json", "parse JSON and pp."){|x| opts[:type] = "json"}
95
95
  opp.on("-x", "--xml", "parse XML using REXML and pp."){|x| opts[:type] = "xml"}
@@ -151,8 +151,8 @@ class PPCommand
151
151
  pp_json(source)
152
152
  when "csv"
153
153
  pp_csv(source)
154
- when "csvhash"
155
- pp_csv_as_hash(source)
154
+ when "csvtable"
155
+ pp_csvtable(source)
156
156
  when "html"
157
157
  pp_html(source)
158
158
  when "text"
data/ppcommand.gemspec CHANGED
@@ -5,13 +5,13 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ppcommand}
8
- s.version = "0.1.3"
8
+ s.version = "0.1.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["KOSEKI Kengo"]
12
- s.date = %q{2010-04-09}
12
+ s.date = %q{2010-04-11}
13
13
  s.default_executable = %q{pp}
14
- s.description = %q{pretty print YAML/JSON/XML}
14
+ s.description = %q{Parse and pp YAML/JSON/XML/CSV/HTML}
15
15
  s.email = %q{koseki@gmail.com}
16
16
  s.executables = ["pp"]
17
17
  s.extra_rdoc_files = [
@@ -36,7 +36,7 @@ Gem::Specification.new do |s|
36
36
  s.rdoc_options = ["--charset=UTF-8"]
37
37
  s.require_paths = ["lib"]
38
38
  s.rubygems_version = %q{1.3.5}
39
- s.summary = %q{pretty print YAML/JSON/XML}
39
+ s.summary = %q{Parse and pp YAML/JSON/XML/CSV/HTML}
40
40
  s.test_files = [
41
41
  "spec/ppcommand_spec.rb",
42
42
  "spec/spec_helper.rb"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ppcommand
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - KOSEKI Kengo
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-04-09 00:00:00 +09:00
12
+ date: 2010-04-11 00:00:00 +09:00
13
13
  default_executable: pp
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -42,7 +42,7 @@ dependencies:
42
42
  - !ruby/object:Gem::Version
43
43
  version: 1.2.9
44
44
  version:
45
- description: pretty print YAML/JSON/XML
45
+ description: Parse and pp YAML/JSON/XML/CSV/HTML
46
46
  email: koseki@gmail.com
47
47
  executables:
48
48
  - pp
@@ -91,7 +91,7 @@ rubyforge_project:
91
91
  rubygems_version: 1.3.5
92
92
  signing_key:
93
93
  specification_version: 3
94
- summary: pretty print YAML/JSON/XML
94
+ summary: Parse and pp YAML/JSON/XML/CSV/HTML
95
95
  test_files:
96
96
  - spec/ppcommand_spec.rb
97
97
  - spec/spec_helper.rb