mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-11 05:17:41 +03:00
Merge branch 'feature-3826'
This commit is contained in:
commit
e67147345a
@ -25,6 +25,14 @@ module CLIHelper
|
||||
:description => "Selects columns to display with list command"
|
||||
}
|
||||
|
||||
LISTCONF = {
|
||||
:name => "listconf",
|
||||
:short => "-c conf",
|
||||
:large => "--listconf conf",
|
||||
:format => String,
|
||||
:description => "Selects a predefined column list"
|
||||
}
|
||||
|
||||
CSV_OPT = {
|
||||
:name => "csv",
|
||||
:large => "--csv",
|
||||
@ -64,7 +72,7 @@ module CLIHelper
|
||||
}
|
||||
|
||||
#OPTIONS = [LIST, ORDER, FILTER, HEADER, DELAY]
|
||||
OPTIONS = [LIST, DELAY, FILTER, CSV_OPT]
|
||||
OPTIONS = [LIST, LISTCONF, DELAY, FILTER, CSV_OPT]
|
||||
|
||||
# Sets bold font
|
||||
def CLIHelper.scr_bold
|
||||
@ -320,7 +328,20 @@ module CLIHelper
|
||||
config = YAML.load_file(@conf)
|
||||
|
||||
default = config.delete(:default)
|
||||
@default_columns = default unless default.empty?
|
||||
default_conf = config.delete(:default_conf) || {}
|
||||
listconf = options[:listconf]
|
||||
|
||||
listconf = default_conf[listconf.to_sym] if listconf
|
||||
|
||||
if !listconf && ENV['ONE_LISTCONF']
|
||||
listconf = default_conf[ENV['ONE_LISTCONF'].to_sym]
|
||||
end
|
||||
|
||||
if listconf
|
||||
@default_columns = listconf
|
||||
else
|
||||
@default_columns = default unless default.empty?
|
||||
end
|
||||
|
||||
# Filter show options with available columns
|
||||
@default_columns &= @columns.keys
|
||||
|
@ -59,3 +59,14 @@
|
||||
- :UMEM
|
||||
- :HOST
|
||||
- :TIME
|
||||
|
||||
:default_conf:
|
||||
:user:
|
||||
- :ID
|
||||
- :NAME
|
||||
- :STAT
|
||||
- :UCPU
|
||||
- :UMEM
|
||||
- :HOST
|
||||
- :IP
|
||||
- :TIME
|
||||
|
Loading…
Reference in New Issue
Block a user