class Morpheus::Cli::VersionCommand

Public Class Methods

new() click to toggle source
# File lib/morpheus/cli/commands/version_command.rb, line 8
def initialize
end

Public Instance Methods

handle(args) click to toggle source
# 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
usage() click to toggle source
# File lib/morpheus/cli/commands/version_command.rb, line 11
def usage
  "morpheus version"
end