Class: Morpheus::Cli::VersionCommand

Inherits:
Object
  • Object
show all
Includes:
CliCommand
Defined in:
lib/morpheus/cli/commands/version_command.rb

Instance Attribute Summary

Attributes included from CliCommand

#no_prompt

Instance Method Summary collapse

Methods included from CliCommand

#add_query_parameter, #apply_options, #build_common_options, #build_get_options, #build_list_options, #build_option_type_options, #build_standard_add_many_options, #build_standard_add_options, #build_standard_api_options, #build_standard_delete_options, #build_standard_get_options, #build_standard_list_options, #build_standard_post_options, #build_standard_put_options, #build_standard_remove_options, #build_standard_update_options, #command_description, #command_name, #confirm, #confirm!, #default_refresh_interval, #default_sigdig, #default_subcommand, #establish_remote_appliance_connection, #execute_api, #execute_api_payload, #execute_api_request, #find_all, #find_all_json, #find_by_id, #find_by_name, #find_by_name_or_id, #find_record, #find_record_json, #full_command_usage, #get_interface, #get_list_key, #get_object_key, #get_subcommand_description, #handle_each_payload, #handle_subcommand, included, #interactive?, #my_help_command, #my_terminal, #my_terminal=, #parse_array, #parse_bytes_param, #parse_get_options!, #parse_id_list, #parse_labels, #parse_list_options, #parse_list_options!, #parse_list_subtitles, #parse_options, #parse_parameter_as_resource_id!, #parse_passed_options, #parse_payload, #parse_query_options, #print, #print_error, #println, #prog_name, #puts, #puts_error, #raise_args_error, #raise_command_error, #render_response, #run_command_for_each_arg, #subcommand_aliases, #subcommand_description, #subcommand_usage, #subcommands, #validate_outfile, #verify_args!, #visible_subcommands

Constructor Details

#initializeVersionCommand

Returns a new instance of VersionCommand.



8
9
# File 'lib/morpheus/cli/commands/version_command.rb', line 8

def initialize
end

Instance Method Details

#handle(args) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/morpheus/cli/commands/version_command.rb', line 15

def handle(args)
  options = {}
  optparse = Morpheus::Cli::OptionParser.new do |opts|
    opts.banner = usage
    opts.on('-v','--short', "Print only the client version number") do |val|
      options[:short] = true
    end
    build_common_options(opts, options)
  end
  optparse.parse!(args)

  client_version = Morpheus::Cli::VERSION
  if options[:short]
    puts client_version
  else
    print cyan
    banner = "" +
      "   __  ___              __              \n" +
      "  /  |/  /__  _______  / /  ___ __ _____\n" +
      " / /|_/ / _ \\/ __/ _ \\/ _ \\/ -_) // (_-<\n" +
      "/_/  /_/\\___/_/ / .__/_//_/\\__/\\_,_/___/\n" +
      "****************************************"
    puts(banner)
    puts("  Client Version: #{client_version}")
    puts("****************************************")
    print reset
  end
end

#usageObject



11
12
13
# File 'lib/morpheus/cli/commands/version_command.rb', line 11

def usage
  "morpheus version"
end