diff --git a/src/cli/cli_helper.rb b/src/cli/cli_helper.rb index f2b4329824..b223d7c21e 100644 --- a/src/cli/cli_helper.rb +++ b/src/cli/cli_helper.rb @@ -571,8 +571,8 @@ module CLIHelper # @return [Array] Array with selected columns information def data_array(data, options) res_data = data.collect do |d| - @columns.collect do |_, params| - params[:proc].call(d).to_s + @default_columns.collect do |c| + @columns[c][:proc].call(d).to_s if @columns[c] end end @@ -580,6 +580,10 @@ module CLIHelper filter_data!(res_data, options) if options[:filter] end + return res_data unless options[:list] + + @default_columns = options[:list].collect {|o| o.upcase.to_sym } + res_data end @@ -797,10 +801,6 @@ module CLIHelper rescue StandardError => e CLIHelper.fail(e.message) end - - return unless options[:list] - - @default_columns = options[:list].collect {|o| o.upcase.to_sym } end # Filter data