Module: CloudCLI
- Defined in:
- lib/cloud/CloudClient.rb
Overview
Command line help functions
Instance Method Summary collapse
-
#cmd_name ⇒ Object
Returns the command name.
- #print_xml(xml_text) ⇒ Object
- #version_text ⇒ Object
Instance Method Details
#cmd_name ⇒ Object
Returns the command name
197 198 199 |
# File 'lib/cloud/CloudClient.rb', line 197 def cmd_name File.basename($0) end |
#print_xml(xml_text) ⇒ Object
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/cloud/CloudClient.rb', line 170 def print_xml(xml_text) begin doc = REXML::Document.new(xml_text) rescue REXML::ParseException => e return e., -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_text ⇒ Object
201 202 203 204 205 206 207 208 209 210 |
# File 'lib/cloud/CloudClient.rb', line 201 def version_text version=<<EOT OpenNebula #{CloudClient::VERSION} Copyright 2002-2016, 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 |