Module: CloudCLI

Defined in:
lib/cloud/CloudClient.rb

Overview

Command line help functions

Instance Method Summary collapse

Instance Method Details

#cmd_nameObject

Returns the command name



225
226
227
# File 'lib/cloud/CloudClient.rb', line 225

def cmd_name
    File.basename($0)
end


198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# File 'lib/cloud/CloudClient.rb', line 198

def print_xml(xml_text)
    begin
        doc = REXML::Document.new(xml_text)
    rescue REXML::ParseException => e
        return e.message, -1
    end

    xml = doc.root

    if xml.nil?
        return xml_text, -1
    end

    str = String.new
    if REXML_FORMATTERS
        formatter = REXML::Formatters::Pretty.new
        formatter.compact = true

        formatter.write(xml,str)
    else
        str = xml.to_s
    end

    return str, 0
end

#version_textObject



229
230
231
232
233
234
235
236
237
238
# File 'lib/cloud/CloudClient.rb', line 229

def version_text
    version=<<EOT
OpenNebula #{CloudClient::VERSION}
Copyright 2002-2024, OpenNebula Project, OpenNebula Systems

Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
EOT
end