Class PropfindCLI
In: lib/davclient/dav-propfind.rb
lib/davclient/dav-propfind.rb
Parent: Object

Methods

propfind   propfind  

Public Class methods

[Source]

    # File lib/davclient/dav-propfind.rb, line 8
 8:   def self.propfind(args)
 9:     options = read_options(args)
10: 
11:     url = args[0]
12:     if(not(url)) then
13:       url = WebDAV.CWURL
14:     end
15: 
16:     if(not(url)) then
17:       puts "Error: Missing mandatory url"
18:       puts optparse
19:       exit
20:     end
21: 
22:     if(options[:xml])then
23:       puts WebDAV.propfind(url, :xml => true)
24:     else
25: 
26:       # TODO This is experimental code in desperat need
27:       # of love and attention
28:       item = WebDAV.propfind(url)
29:       puts item.collection
30: 
31:       prev_url = nil
32:       WebDAV.find(url, :children => options[:children]) do | url, item |
33:         if(prev_url != url) then
34:           puts
35:           puts "url = " + url.to_s
36:           prev_url = url
37:         end
38: 
39:         name = item.prefix
40:         if(item.namespace)then
41:           name = name + "(" + item.namespace + ")"
42:         end
43:         name = name + item.name
44:         puts name.ljust(40) + " = '" + item.text.to_s + "'"
45:       end
46: 
47:     end
48: 
49:   end

[Source]

    # File lib/davclient/dav-propfind.rb, line 8
 8:   def self.propfind(args)
 9:     options = read_options(args)
10: 
11:     url = args[0]
12:     if(not(url)) then
13:       url = WebDAV.CWURL
14:     end
15: 
16:     if(not(url)) then
17:       puts "Error: Missing mandatory url"
18:       puts optparse
19:       exit
20:     end
21: 
22:     if(options[:xml])then
23:       puts WebDAV.propfind(url, :xml => true)
24:     else
25: 
26:       # TODO This is experimental code in desperat need
27:       # of love and attention
28:       item = WebDAV.propfind(url)
29:       puts item.collection
30: 
31:       prev_url = nil
32:       WebDAV.find(url, :children => options[:children]) do | url, item |
33:         if(prev_url != url) then
34:           puts
35:           puts "url = " + url.to_s
36:           prev_url = url
37:         end
38: 
39:         name = item.prefix
40:         if(item.namespace)then
41:           name = name + "(" + item.namespace + ")"
42:         end
43:         name = name + item.name
44:         puts name.ljust(40) + " = '" + item.text.to_s + "'"
45:       end
46: 
47:     end
48: 
49:   end

[Validate]