ix-cli 0.0.14 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/ix-hls +7 -11
- data/bin/ix-log +2 -1
- data/bin/ix-timestamp2 +50 -8
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1457129da9fa04dd6d4241cf824afc2998a0302cdf9bd4b915088f61b48f53ac
|
4
|
+
data.tar.gz: 1837dc100f225e4fd9d919465003c3874d629ec6a5e5f2b125625ea82a588947
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97c0c9b0879c2c6b557e09907db966a0a2fbdcbfade5477ac60ddc77fd9367b41bb5ddbd6a60b66525cf45dbe305872812cb0789f962395cd6347a671db1463b
|
7
|
+
data.tar.gz: dced22aa4a1e694ceaf0aa4113e6d7b7c6e5d6e4e175cd18e4a2ade63c1c141780a045ff40f138df6584f39f7fa2f0d9ab2ad9b04fd21db180c2c1f1c15e3c6b
|
data/bin/ix-hls
CHANGED
@@ -1,21 +1,17 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
#
|
6
|
-
# line ix-highlight-line highlight a specific line
|
7
|
-
# vertical ix-highlight-vertical highlight a particular column
|
8
|
-
# highlight ix-highlight-match highlight whatever matches a regex
|
9
|
-
#
|
10
|
-
|
3
|
+
require 'rubygems'
|
4
|
+
require 'isna'
|
11
5
|
|
12
6
|
abort 'No pattern given' if ARGV[0].nil?
|
13
7
|
|
14
8
|
trap('SIGINT') { }
|
15
9
|
|
16
|
-
$stdout.sync = true
|
17
|
-
|
18
10
|
STDIN.each_line do |line|
|
19
|
-
|
11
|
+
ARGV.each do |setting|
|
12
|
+
matcher, color = setting.split(':')
|
13
|
+
line.gsub!(/(#{matcher})/i) { |x| "#{$1}".to_ansi.send(:"#{color}").to_s }
|
14
|
+
end
|
15
|
+
puts line
|
20
16
|
end
|
21
17
|
|
data/bin/ix-log
CHANGED
data/bin/ix-timestamp2
CHANGED
@@ -1,14 +1,56 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
3
|
+
require 'json'
|
4
|
+
require 'isna'
|
4
5
|
|
5
|
-
|
6
|
+
start = false
|
7
|
+
prev = false
|
8
|
+
lineno = 0
|
9
|
+
colors = true
|
6
10
|
|
7
|
-
STDIN.
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
STDIN.each_line do |line|
|
12
|
+
begin
|
13
|
+
lineno += 1
|
14
|
+
json = JSON.parse(line)
|
15
|
+
timestamp = json['timestamp'].to_f
|
16
|
+
unless start
|
17
|
+
start = timestamp
|
18
|
+
prev = timestamp
|
19
|
+
end
|
20
|
+
|
21
|
+
object = {
|
22
|
+
:timestamp => timestamp.to_s.rjust(20, ' '),
|
23
|
+
:time => Time.at(timestamp).to_s.rjust(20, ' '),
|
24
|
+
:elapsed => format('%1.5f', (timestamp - start)).to_s.rjust(10, ' '),
|
25
|
+
:diff => format('%2.5f', (timestamp - prev)).to_s.rjust(10, ' '),
|
26
|
+
:lineno => (('| ') + (lineno.to_s)).ljust(5, ' '),
|
27
|
+
:message => json['message']
|
28
|
+
}
|
29
|
+
|
30
|
+
if colors
|
31
|
+
object[:timestamp] = object[:timestamp].to_s.to_ansi.yellow.to_s
|
32
|
+
object[:time] = object[:time].to_s.to_ansi.cyan.to_s
|
33
|
+
object[:elapsed] = object[:elapsed].to_s.to_ansi.pink.to_s
|
34
|
+
|
35
|
+
if (timestamp - prev) > 1 and (timestamp - prev) < 10
|
36
|
+
object[:diff] = object[:diff].to_s.to_ansi.green.to_s
|
37
|
+
end
|
38
|
+
|
39
|
+
if (timestamp - prev) > 10 and (timestamp - prev) < 50
|
40
|
+
object[:diff] = object[:diff].to_s.to_ansi.yellow.to_s
|
41
|
+
end
|
42
|
+
|
43
|
+
if (timestamp - prev) > 50
|
44
|
+
object[:diff] = object[:diff].to_s.to_ansi.red.to_s
|
45
|
+
end
|
46
|
+
|
47
|
+
object[:lineno] = object[:lineno].to_s.to_ansi.cyan.to_s
|
48
|
+
end
|
49
|
+
|
50
|
+
puts format("%<timestamp>s %<time>s %<elapsed>s %<diff>s %<lineno>s %<message>s", object)
|
51
|
+
prev = timestamp
|
52
|
+
rescue => e
|
53
|
+
puts e.message
|
54
|
+
end
|
13
55
|
end
|
14
56
|
|