Sha256: f6a073b354ce91d129e4e1dc79ae28f716a324205e6a0e607ed7571d10b68e41

Contents?: true

Size: 629 Bytes

Versions: 5

Compression:

Stored size: 629 Bytes

Contents

require 'conjur/command'

class Conjur::Command::Field < Conjur::Command
  self.prefix = :field
  
  desc "(Deprecated. See standalone jsonfield command instead.)"
  command :select do |c|
    c.action do |global_options,options,args|
      pattern = require_arg(args, 'pattern')
      value = args.shift || STDIN.read

      warn "field:select is deprecated. Please use jsonfield command instead."
      require 'json'
      json = JSON.parse(value)
      class << json
        def get_binding
          record = self
          
          binding
        end
      end
      puts json.get_binding.eval(pattern)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
conjur-cli-2.6.0 lib/conjur/command/field.rb
conjur-cli-2.4.1 lib/conjur/command/field.rb
conjur-cli-2.4.0 lib/conjur/command/field.rb
conjur-cli-2.3.0 lib/conjur/command/field.rb
conjur-cli-2.2.1 lib/conjur/command/field.rb