ltsview 0.0.2 → 0.0.3

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.md CHANGED
@@ -46,10 +46,22 @@ Or install it yourself as:
46
46
 
47
47
  $ ltsview -f logfile.ltsv
48
48
 
49
+ render json
50
+
51
+ $ cat logfile.ltsv | ltsview -j
52
+
53
+ appended tag
54
+
55
+ $ cat logfile.ltsv | ltsview -t sample.tag
56
+
49
57
  ### Option
50
58
 
51
- * `-k , --keys VAL` to display keys select
52
- * `-i, --ignore-key VAL` to ignore keys select display
59
+ * `-k` ,` --keys VAL` to display keys select
60
+ * `-i`, `--ignore-key VAL` to ignore keys select display
61
+ * `-r`, `--regexp KEY:VAL`
62
+ * `-f`, `--file VAL` to load ltsv format file
63
+ * `-j`, `--json` to render json format
64
+ * `-t`, `--tag` to append tag
53
65
 
54
66
  ## Contributing
55
67
 
@@ -15,7 +15,8 @@ module Ltsview
15
15
 
16
16
  def print
17
17
  file_or_stdin do |ltsv|
18
- puts "#{tag}#{formatter(filter(ltsv))}"
18
+ line = formatter(filter(ltsv))
19
+ puts "#{tag}#{line}" unless line.nil?
19
20
  end
20
21
  end
21
22
 
@@ -54,7 +55,7 @@ module Ltsview
54
55
  end
55
56
 
56
57
  def formatter(ltsv)
57
- color ltsv.send("to_#{@options[:mode]}".to_sym), @options[:mode]
58
+ color ltsv.send("to_#{@options[:mode]}".to_sym), @options[:mode] unless ltsv.empty?
58
59
  end
59
60
 
60
61
  def tag
@@ -1,3 +1,3 @@
1
1
  module Ltsview
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -42,7 +42,7 @@ describe Ltsview::Parse do
42
42
  parse = Ltsview::Parse.new(['-f','spec/test.ltsv'])
43
43
  capture(:stdout){
44
44
  parse.print
45
- }.must_equal("\e[45m---\e[0m\n\e[1;32m:hoge\e[0m: \e[1;33m\e[41mfuga hago\e[0m\n\e[1;32m:foo\e[0m: \e[1;33m\e[41mbarbaz\e[0m\n\e[45m---\e[0m {}\n")
45
+ }.must_equal("\e[45m---\e[0m\n\e[1;32m:hoge\e[0m: \e[1;33m\e[41mfuga hago\e[0m\n\e[1;32m:foo\e[0m: \e[1;33m\e[41mbarbaz\e[0m\n")
46
46
  end
47
47
  end
48
48
 
@@ -80,7 +80,7 @@ describe Ltsview::Parse do
80
80
  $stdin << "hago:fuga2 hago\tfoo:fugabarbaz\n"
81
81
  $stdin.rewind
82
82
  parse.print
83
- }.must_equal("\e[45m---\e[0m {}\n\e[45m---\e[0m\n\e[1;32m:hago\e[0m: \e[1;33m\e[41mfuga2 hago\e[0m\n\e[1;32m:foo\e[0m: \e[1;33m\e[41mfugabarbaz\e[0m\n")
83
+ }.must_equal("\e[45m---\e[0m\n\e[1;32m:hago\e[0m: \e[1;33m\e[41mfuga2 hago\e[0m\n\e[1;32m:foo\e[0m: \e[1;33m\e[41mfugabarbaz\e[0m\n")
84
84
  end
85
85
  end
86
86
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ltsview
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-18 00:00:00.000000000 Z
12
+ date: 2013-02-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ltsv