ddtop 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ddtop/ddtop.rb +9 -11
- data/lib/ddtop/version.rb +1 -1
- metadata +1 -1
data/lib/ddtop/ddtop.rb
CHANGED
@@ -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 -
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
puts
|
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+/)
|
data/lib/ddtop/version.rb
CHANGED