class CfScript::Command::Apps::EnvCommand

Public Class Methods

new() click to toggle source
Calls superclass method CfScript::Command::Base::new
# File lib/cf_script/command/cf/apps/env.rb, line 3
def initialize
  super(:apps, :env)
end

Public Instance Methods

run(app_name) { |to_h| ... } click to toggle source
# File lib/cf_script/command/cf/apps/env.rb, line 7
def run(app_name, &block)
  run_cf self, app_name do |output|
    return {} unless good_run?(output)

    if vars = output.section_attributes('User-Provided')
      block_given? ? yield(vars.to_h) : vars.to_h
    elsif output.contains?('No user-defined env variables have been set')
      return {}
    else
      error 'could not get environment variables'
      return {}
    end
  end
end