module Occi::Cli::Helpers::ListHelper
Public Instance Methods
helper_list(options, output = nil)
click to toggle source
# File lib/occi/cli/helpers/list_helper.rb, line 3 def helper_list(options, output = nil) found = [] if resource_types.include?(options.resource) || resource_type_identifiers.include?(options.resource) Occi::Cli::Log.debug "#{options.resource.inspect} is a resource type." found = list options.resource elsif mixin_types.include?(options.resource) || mixin_type_identifiers.include?(options.resource) Occi::Cli::Log.debug "#{options.resource.inspect} is a mixin type." found = mixin_list options.resource else Occi::Cli::Log.error "I have no idea what #{options.resource.inspect} is ..." raise "Unknown resource #{options.resource.inspect}, there is nothing to list here!" end helper_list_output(found, options, output) end
helper_list_output(found, options, output)
click to toggle source
# File lib/occi/cli/helpers/list_helper.rb, line 20 def helper_list_output(found, options, output) return found unless output puts output.format(found) end