class Crowbar::Client::Command::Proposal::Show

Implementation for the proposal show command

Public Instance Methods

execute() click to toggle source
# File lib/crowbar/client/command/proposal/show.rb, line 37
def execute
  validate_barclamp! args.barclamp

  request.process do |request|
    case request.code
    when 200
      content = if options[:raw]
        content_from(request)
      else
        deployment_cleanup(content_from(request))
      end

      formatter = Formatter::Nested.new(
        format: provide_format,
        path: provide_filter,
        headings: ["Key", "Value"],
        values: Filter::Subset.new(
          filter: provide_filter,
          values: content
        ).result
      )

      if formatter.empty?
        err "No result"
      else
        say formatter.result
      end
    when 404
      err "Proposal does not exist"
    else
      err request.parsed_response["error"]
    end
  end
end
request() click to toggle source
# File lib/crowbar/client/command/proposal/show.rb, line 31
def request
  @request ||= Request::Proposal::Show.new(
    args
  )
end

Protected Instance Methods

content_from(request) click to toggle source
# File lib/crowbar/client/command/proposal/show.rb, line 74
def content_from(request)
  request.parsed_response
end