Sha256: c78563e635e40ea04e8d3e5b9d19f1be5a0af159d45a14fcb9dceef41d485b88

Contents?: true

Size: 1.13 KB

Versions: 11

Compression:

Stored size: 1.13 KB

Contents

module PDK::CLI
  @config_get_cmd = @config_cmd.define_command do
    name 'get'
    usage _('config get [name]')
    summary _('(Deprecated) Retrieve the configuration for <name>. If not specified, retrieve all configuration settings')

    run do |_opts, args, _cmd|
      PDK.logger.warn _('The \'pdk config get\' command is deprecated, please use \'pdk get config\' instead.')

      item_name = args[0]
      resolved_config = PDK.config.resolve(item_name)
      # If the user wanted to know a setting but it doesn't exist, raise an error
      if resolved_config.empty? && !item_name.nil?
        PDK.logger.error(_("Configuration item '%{name}' does not exist") % { name: item_name })
        exit 1
      end
      # If the user requested a setting and it's the only one resolved, then just output the value
      if resolved_config.count == 1 && resolved_config.keys[0] == item_name
        puts _('%{value}') % { value: resolved_config.values[0] }
        exit 0
      end
      # Otherwise just output everything
      resolved_config.keys.sort.each { |key| puts _('%{name}=%{value}') % { name: key, value: resolved_config[key] } }
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
pdk-2.6.1 lib/pdk/cli/config/get.rb
pdk-2.6.0 lib/pdk/cli/config/get.rb
pdk-2.5.0 lib/pdk/cli/config/get.rb
pdk-2.3.0 lib/pdk/cli/config/get.rb
pdk-2.2.0 lib/pdk/cli/config/get.rb
pdk-2.1.1 lib/pdk/cli/config/get.rb
pdk-2.1.0 lib/pdk/cli/config/get.rb
pdk-2.0.0 lib/pdk/cli/config/get.rb
pdk-1.18.1 lib/pdk/cli/config/get.rb
pdk-1.18.0 lib/pdk/cli/config/get.rb
pdk-1.17.0 lib/pdk/cli/config/get.rb