1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-27 10:50:10 +03:00

feature #4217. Better output for CLI commands

This commit is contained in:
Ruben S. Montero 2015-12-18 12:53:53 +01:00
parent f9910aa103
commit e4cd7b45e6
4 changed files with 33 additions and 37 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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')]