ddtop 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/ddtop/ddtop.rb +9 -11
  2. data/lib/ddtop/version.rb +1 -1
  3. metadata +1 -1
@@ -58,7 +58,7 @@ class Ddtop::Ddtop
58
58
  end
59
59
  end
60
60
 
61
- def gets_with_print(top)
61
+ def gets_with_print(top, esq = nil)
62
62
  line = top.gets
63
63
 
64
64
  if head?(line)
@@ -71,15 +71,13 @@ class Ddtop::Ddtop
71
71
  @curr_row += 1
72
72
 
73
73
  if @curr_row <= @win_rows
74
- line.chomp!
75
- delta = @win_cols - line.length
76
- line += ' ' * (@win_cols - line.length) if delta > 0
77
- end
78
-
79
- if @curr_row < @win_rows
80
- puts line[0, @win_cols]
81
- elsif @curr_row == @win_rows
82
- print line[0, @win_cols]
74
+ pline = line.chomp
75
+ delta = @win_cols - pline.length
76
+ pline += ' ' * (@win_cols - pline.length) if delta > 0
77
+ pline = pline[0, @win_cols]
78
+ pline = esq + pline + "\e[0m" if esq
79
+ print pline
80
+ puts if @curr_row != @win_rows
83
81
  end
84
82
 
85
83
  return line.strip
@@ -92,7 +90,7 @@ class Ddtop::Ddtop
92
90
  def parse_header(top, line)
93
91
  summary_lines = [line] + (1..4).map { gets_with_print(top) }
94
92
  gets_with_print(top)
95
- fields_line = gets_with_print(top)
93
+ fields_line = gets_with_print(top, "\e[7m")
96
94
 
97
95
  summary = parse_summary(summary_lines)
98
96
  fields = fields_line.split(/\s+/)
@@ -1,3 +1,3 @@
1
1
  module Ddtop
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ddtop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: