virtop 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/bin/virtop +13 -2
- data/lib/virtop.rb +1 -1
- metadata +1 -1
data/bin/virtop
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'ncursesw'
|
4
4
|
require 'uri'
|
5
|
+
require 'yaml'
|
5
6
|
|
6
7
|
# Require and include virtop module. It will require libvirt.
|
7
8
|
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
@@ -24,10 +25,20 @@ EOF
|
|
24
25
|
exit 1
|
25
26
|
end
|
26
27
|
|
28
|
+
config = {
|
29
|
+
'urls' => ['qemu:///system'],
|
30
|
+
'sort_by' => 0
|
31
|
+
}
|
32
|
+
|
33
|
+
begin
|
34
|
+
config.merge!(YAML.load_file(File.expand_path('~/.virtop.yaml')))
|
35
|
+
rescue Errno::ENOENT
|
36
|
+
end
|
37
|
+
|
27
38
|
# Connection URL will be qemu:///system if nothing else is given as the first
|
28
39
|
# parameter.
|
29
40
|
if ARGV.size < 1
|
30
|
-
urls = ['
|
41
|
+
urls = config['urls']
|
31
42
|
else
|
32
43
|
urls = []
|
33
44
|
|
@@ -69,7 +80,7 @@ begin
|
|
69
80
|
Ncurses.halfdelay 10
|
70
81
|
|
71
82
|
# Default sorting by first column (domain name).
|
72
|
-
sortBy =
|
83
|
+
sortBy = config['sort_by']
|
73
84
|
|
74
85
|
while true
|
75
86
|
Ncurses.clear
|
data/lib/virtop.rb
CHANGED