1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-23 17:33:56 +03:00

feature #661: Define description for OpenNebula formatters

This commit is contained in:
Daniel Molina 2011-06-08 16:11:27 +02:00
parent 96d2ddcf41
commit 263ec3543f
3 changed files with 28 additions and 30 deletions

View File

@ -39,10 +39,6 @@ EOT
:description => "Show the resource in xml format"
}
########################################################################
# Formatters descriptions
########################################################################
class OneHelper
def initialize
@client = OpenNebula::Client.new
@ -117,6 +113,28 @@ EOT
exit_code
end
########################################################################
# Formatters descriptions
########################################################################
def self.filter_flag_desc
desc=<<-EOT
a, all all the known #{self.rname}s
m, mine the #{self.rname} belonging to the user in ONE_AUTH
g, group 'mine' plus the #{self.rname} belonging to the groups
the user is member of
uid #{self.rname} of the user identified by this uid
user #{self.rname} of the user identified by the username
EOT
end
def self.oneid_list_desc
"Comma-separated list of OpenNebula #{self.rname} names or ids"
end
def self.oneid_desc
"OpenNebula #{self.rname} name or id"
end
########################################################################
# Formatters for arguments
########################################################################

View File

@ -44,25 +44,15 @@ cmd=CommandParser::CmdParser.new(ARGV) do
########################################################################
# Formatters for arguments
########################################################################
oneid_desc='OpenNebula Virtual Machine name or id'
set :format, :vmid, oneid_desc do |arg|
set :format, :vmid, OneVMHelper.oneid_desc do |arg|
helper.to_id(arg)
end
onelistid_desc='Comma-separated list of OpenNebula Virtual Machine names or ids'
set :format, :vmid_list, onelistid_desc do |arg|
set :format, :vmid_list, OneVMHelper.oneid_list_desc do |arg|
helper.list_to_id(arg)
end
filterflag_desc=<<-EOT
a, all all the known Virtual Machine
m, mine the Virtual Machine belonging to the user in ONE_AUTH
g, group 'mine' plus the Virtual Machine belonging to the groups
the user is member of
uid Virtual Machine of the user identified by this uid
user Virtual Machine of the user identified by the username
EOT
set :format, :filterflag, filterflag_desc do |arg|
set :format, :filterflag, OneVMHelper.filter_flag_desc do |arg|
helper.filterflag_to_i(arg)
end

View File

@ -44,25 +44,15 @@ cmd=CommandParser::CmdParser.new(ARGV) do
########################################################################
# Formatters for arguments
########################################################################
oneid_desc='OpenNebula Virtual Network name or id'
set :format, :vnetid, oneid_desc do |arg|
set :format, :vnetid, OneVNetHelper.oneid_desc do |arg|
helper.to_id(arg)
end
onelistid_desc='Comma-separated list of OpenNebula Virtual Network names or ids'
set :format, :vnetid_list, onelistid_desc do |arg|
set :format, :vnetid_list, OneVNetHelper.oneid_list_desc do |arg|
helper.list_to_id(arg)
end
filterflag_desc=<<-EOT
a, all all the known Virtual Networks
m, mine the Virtual Networks belonging to the user in ONE_AUTH
g, group 'mine' plus the Virtual Networks belonging to the groups
the user is member of
uid Virtual Networks of the user identified by this uid
user Virtual Networks of the user identified by the username
EOT
set :format, :filterflag, filterflag_desc do |arg|
set :format, :filterflag, OneVNetHelper.filter_flag_desc do |arg|
helper.filterflag_to_i(arg)
end