Class: PropfindCLI

Inherits:
Object
  • Object
show all
Defined in:
lib/davclient/dav-propfind.rb

Class Method Summary collapse

Class Method Details

.propfind(args) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/davclient/dav-propfind.rb', line 8

def self.propfind(args)
  options = read_options(args)

  url = args[0]
  if(not(url)) then
    url = WebDAV.CWURL
  end

  if(not(url)) then
    puts "Error: Missing mandatory url"
    puts optparse
    exit
  end

  if(options[:xml])then
    puts WebDAV.propfind(url, :xml => true)
  else

    # TODO This is experimental code in desperat need
    # of love and attention
    item = WebDAV.propfind(url)
    puts item.collection

    prev_url = nil
    WebDAV.find(url, :children => options[:children]) do | url, item |
      if(prev_url != url) then
        puts
        puts "url = " + url.to_s
        prev_url = url
      end

      name = item.prefix
      if(item.namespace)then
        name = name + "(" + item.namespace + ")"
      end
      name = name + item.name
      puts name.ljust(40) + " = '" + item.text.to_s + "'"
    end

  end

end