diff --git a/src/cli/cli_helper.rb b/src/cli/cli_helper.rb index 13e73d83c0..1cbe37dfa7 100644 --- a/src/cli/cli_helper.rb +++ b/src/cli/cli_helper.rb @@ -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,15 @@ module CLIHelper config = YAML.load_file(@conf) default = config.delete(:default) - @default_columns = default unless default.empty? + default_conf = config.delete(:default_conf) || {} + + listconf = default_conf[options[:listconf].to_sym] + + if options[:listconf] && listconf + @default_columns = listconf + else + @default_columns = default unless default.empty? + end # Filter show options with available columns @default_columns &= @columns.keys diff --git a/src/cli/etc/onevm.yaml b/src/cli/etc/onevm.yaml index c84f4db58e..b90a77e1f6 100644 --- a/src/cli/etc/onevm.yaml +++ b/src/cli/etc/onevm.yaml @@ -1,36 +1,36 @@ ---- -:ID: +--- +:ID: :desc: ONE identifier for Virtual Machine :size: 6 -:NAME: +:NAME: :desc: Name of the Virtual Machine :size: 15 :left: true -:USER: +:USER: :desc: Username of the Virtual Machine owner :size: 8 :left: true -:GROUP: +:GROUP: :desc: Group of the Virtual Machine :size: 8 :left: true -:STAT: +:STAT: :desc: Actual status :size: 4 -:UCPU: +:UCPU: :desc: CPU percentage used by the VM :size: 4 -:UMEM: +:UMEM: :desc: Memory used by the VM :size: 7 -:HOST: +:HOST: :desc: Host where the VM is running :size: 10 :left: true @@ -40,7 +40,7 @@ :size: 10 :left: true -:TIME: +:TIME: :desc: Time since the VM was submitted :size: 10 @@ -49,7 +49,7 @@ :left: true :size: 15 -:default: +:default: - :ID - :USER - :GROUP @@ -59,3 +59,14 @@ - :UMEM - :HOST - :TIME + +:default_conf: + :user: + - :ID + - :NAME + - :STAT + - :UCPU + - :UMEM + - :HOST + - :IP + - :TIME