class Retscli::ShellCommands

Public Class Methods

banner(command, namespace = nil, subcommand = false) click to toggle source

since we are using thor for shell commands we want to remove executable name from command help menu

Calls superclass method
command_list() click to toggle source
# File lib/retscli/shell_commands.rb, line 16
def self.command_list
  all_commands.keys.map{ |command| command.gsub('_', '-') }
end
new(args, options, config) click to toggle source
Calls superclass method
# File lib/retscli/shell_commands.rb, line 5
def initialize(args, options, config)
  super
  @display_adapter = config[:display_adapter]
end

Public Instance Methods

capabilities() click to toggle source
# File lib/retscli/shell_commands.rb, line 26
def capabilities
  @display_adapter.page(@display_adapter.capabilities)
end
classes(resource) click to toggle source
# File lib/retscli/shell_commands.rb, line 42
def classes(resource)
  if options[:editor]
    @display_adapter.open_in_editor(@display_adapter.classes(resource), options[:editor])
  else
    @display_adapter.page(@display_adapter.classes(resource))
  end
end
login() click to toggle source
# File lib/retscli/shell_commands.rb, line 21
def login
  puts @display_adapter.login
end
metadata() click to toggle source
# File lib/retscli/shell_commands.rb, line 79
def metadata
  if options[:editor]
    @display_adapter.open_in_editor(@display_adapter.metadata, options[:editor])
  else
    @display_adapter.page(@display_adapter.metadata)
  end
end
objects(resource) click to toggle source
# File lib/retscli/shell_commands.rb, line 62
def objects(resource)
  if options[:editor]
    @display_adapter.open_in_editor(@display_adapter.objects(resource), options[:editor])
  else
    @display_adapter.page(@display_adapter.objects(resource))
  end
end
resources() click to toggle source
# File lib/retscli/shell_commands.rb, line 32
def resources
  if options[:editor]
    @display_adapter.open_in_editor(@display_adapter.resources, options[:editor])
  else
    @display_adapter.page(@display_adapter.resources)
  end
end
search_metadata(search) click to toggle source
# File lib/retscli/shell_commands.rb, line 91
def search_metadata(search)
  search_options = {
    :classes => options[:classes],
    :resources => options[:resources]
  }

  if options[:editor]
    @display_adapter.open_in_editor(@display_adapter.search_metadata(search, search_options.merge(:color => false)), options[:editor])
  else
    @display_adapter.page(@display_adapter.search_metadata(search, search_options))
  end
end
tables(resource, klass) click to toggle source
# File lib/retscli/shell_commands.rb, line 52
def tables(resource, klass)
  if options[:editor]
    @display_adapter.open_in_editor(@display_adapter.tables(resource, klass), options[:editor])
  else
    @display_adapter.page(@display_adapter.tables(resource, klass))
  end
end
timezone_offset() click to toggle source
# File lib/retscli/shell_commands.rb, line 71
def timezone_offset
  puts @display_adapter.timezone_offset
end