Module: LdapShellUtils::CliApplication

Extended by:
CliApplication
Included in:
CliApplication
Defined in:
lib/ldap-shell-utils/cli_application.rb

Class Method Summary collapse

Class Method Details

.run(options) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ldap-shell-utils/cli_application.rb', line 9

def self.run(options)

  ConfigContext.configure(File.expand_path(options[:config]))
  
  options = { :audit=>false }.merge(options)
  results = LdapConnection.new(ConfigContext.to_hash).search(options)
  
  results.each do |entry|
    puts "#{entry.dn}"
    entry.each do |attr,values| 
      puts "#{attr}: #{(values.size == 1) ? values[0] : values.inspect}" unless attr == :dn 
    end
  end if results
rescue Exception=>e
  $stderr.puts(e.message)
end