From e4cd7b45e687515a38d40d05c209cbba2a1a19f1 Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Fri, 18 Dec 2015 12:53:53 +0100 Subject: [PATCH] feature #4217. Better output for CLI commands --- src/cli/etc/onemarket.yaml | 6 ++--- src/cli/etc/onemarketapp.yaml | 33 +++++++++++------------ src/cli/one_helper/onemarket_helper.rb | 6 ++--- src/cli/one_helper/onemarketapp_helper.rb | 25 +++++++++-------- 4 files changed, 33 insertions(+), 37 deletions(-) diff --git a/src/cli/etc/onemarket.yaml b/src/cli/etc/onemarket.yaml index 7d6bfca2a6..2d593e1d71 100644 --- a/src/cli/etc/onemarket.yaml +++ b/src/cli/etc/onemarket.yaml @@ -5,7 +5,7 @@ :NAME: :desc: Name of the Marketplace - :size: 13 + :size: 30 :left: true :SIZE: @@ -14,7 +14,7 @@ :AVAIL: :desc: MarketPlace free size (%) - :size: 5 + :size: 10 :left: true :APPS: @@ -28,8 +28,8 @@ :default: - :ID -- :NAME - :SIZE - :AVAIL - :APPS - :MAD +- :NAME diff --git a/src/cli/etc/onemarketapp.yaml b/src/cli/etc/onemarketapp.yaml index 4c40749109..e1958cfa18 100644 --- a/src/cli/etc/onemarketapp.yaml +++ b/src/cli/etc/onemarketapp.yaml @@ -5,49 +5,46 @@ :NAME: :desc: Name of the marketplace app - :size: 13 - :left: true - -:PUBLISHER: - :desc: Publisher of the marketplace app :size: 15 :left: true :VERSION: :desc: Version of the marketplace app - :size: 10 - :left: true + :size: 7 :SIZE: :desc: Marketplace app size (M) - :size: 8 + :size: 5 :STAT: :desc: State of the app :size: 4 - :left: true - -:DATE: - :desc: Publishing date for the marketplace app - :size: 15 :TYPE: :desc: Marketplace app type :size: 4 - :left: true + +:DATE: + :desc: Publishing date for the marketplace app + :size: 8 :MARKET: - :desc: Name of the marketplace - :size: 10 + :desc: ID of the marketplace + :size: 6 + +:PUBLISHER: + :desc: Publisher of the marketplace app + :size: 25 :left: true + :default: - :ID - :NAME -- :PUBLISHER - :VERSION - :SIZE - :STAT -- :DATE - :TYPE +- :DATE - :MARKET +- :PUBLISHER diff --git a/src/cli/one_helper/onemarket_helper.rb b/src/cli/one_helper/onemarket_helper.rb index 7f584cfb3d..872467b294 100644 --- a/src/cli/one_helper/onemarket_helper.rb +++ b/src/cli/one_helper/onemarket_helper.rb @@ -44,7 +44,7 @@ class OneMarketPlaceHelper < OpenNebulaHelper::OneHelper d["ID"] end - column :NAME, "Name of the Marketplace", :left, :size=>13 do |d| + column :NAME, "Name of the Marketplace", :left, :size=>30 do |d| d["NAME"] end @@ -52,7 +52,7 @@ class OneMarketPlaceHelper < OpenNebulaHelper::OneHelper OpenNebulaHelper.unit_to_str(d['TOTAL_MB'].to_i, {}, 'M') end - column :AVAIL, "Marketplace free size", :left, :size =>5 do |d| + column :AVAIL, "Marketplace free size", :left, :size =>10 do |d| if d['TOTAL_MB'].to_i == 0 "-" else @@ -77,7 +77,7 @@ class OneMarketPlaceHelper < OpenNebulaHelper::OneHelper d["MARKET_MAD"] end - default :ID, :NAME, :SIZE, :AVAIL, :APPS, :TYPE, :MAD + default :ID, :SIZE, :AVAIL, :APPS, :TYPE, :MAD, :NAME end table diff --git a/src/cli/one_helper/onemarketapp_helper.rb b/src/cli/one_helper/onemarketapp_helper.rb index 0973acd55b..2f0cf197ab 100644 --- a/src/cli/one_helper/onemarketapp_helper.rb +++ b/src/cli/one_helper/onemarketapp_helper.rb @@ -39,41 +39,40 @@ class OneMarketPlaceAppHelper < OpenNebulaHelper::OneHelper d["ID"] end - column :NAME, "Name of the marketplace app", :left, :size=>13 do |d| + column :NAME, "Name of the marketplace app", :left, :size=>15 do |d| d["NAME"] end - column :PUBLISHER, "Publisher of the App", :left, :size=>15 do |d| + column :PUBLISHER, "Publisher of the App", :left, :size=>25 do |d| d["PUBLISHER"] end - column :VERSION, "Version of the app", :left, :size=>10 do |d| + column :VERSION, "Version of the app", :size=>7 do |d| d["VERSION"] end - column :SIZE, "App size", :size =>8 do |d| + column :SIZE, "App size", :size =>5 do |d| OpenNebulaHelper.unit_to_str(d['SIZE'].to_i, {}, 'M') end - column :STAT, "State of the app", :left, :size=>4 do |d| + column :STAT, "State of the app", :size=>4 do |d| OneMarketPlaceAppHelper.state_to_str(d["STATE"]) end - column :DATE, "Publishing date of the app", - :size=>15 do |d| - OpenNebulaHelper.time_to_str(d["DATE"]) + column :DATE, "Publishing date of the app", :size=>8 do |d| + Time.at(d['DATE'].to_i).strftime("%D") end - column :TYPE, "Marketplace app type", :left, :size=>4 do |d| + column :TYPE, "Marketplace app type", :size=>4 do |d| type = MarketPlaceApp::MARKETPLACEAPP_TYPES[d["TYPE"].to_i] MarketPlaceApp::SHORT_MARKETPLACEAPP_TYPES[type] end - column :MARKET, "Name of the marketplace", :left, :size=>10 do |d| - d["MARKETPLACE"] + column :MARKET, "ID of the marketplace", :size=>6 do |d| + d["MARKETPLACE_ID"] end - default :ID,:NAME,:PUBLISHER,:VERSION,:SIZE,:STAT,:DATE,:TYPE,:MARKET + default :ID,:NAME,:VERSION,:SIZE,:STAT,:TYPE,:DATE,:MARKET,:PUBLISHER end table @@ -126,7 +125,7 @@ class OneMarketPlaceAppHelper < OpenNebulaHelper::OneHelper puts str % ["SOURCE", app['SOURCE']] puts str % ["CHECKSUM", app['CHECKSUM']] puts str % ["PUBLISHER", app['PUBLISHER']] - puts str % ["PUB. DATE", OpenNebulaHelper.time_to_str(app["DATE"])] + puts str % ["PUB. DATE", Time.at(app['DATE'].to_i).strftime("%c") ] puts str % ["VERSION", app['VERSION']] puts str % ["DESCRIPTION", app['DESCRIPTION']] puts str % ["SIZE", OpenNebulaHelper.unit_to_str(app['SIZE'].to_i,{},'M')]