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
50
51
52
53
54
55
56
57
58
|
# File 'lib/dircat/cli/dircat_query.rb', line 13
def parse_args( args )
options = {}
opts = OptionParser.new
opts.banner =
"Usage: dircat_query [options] <filedircat> <command>\n" +
"mostra informazioni su un dircat\n"
opts.on("-h", "--help", "Print this message") do
puts opts
return
end
opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
options[:verbose] = v
end
rest = opts.parse( args )
if rest.length < 2
puts "inserire il nome del catalogo da interrogare e il comando da eseguire"
puts "-h to print help"
return
end
cat_filename = rest[0]
command = rest[1]
if options.has_key?(:verbose)
if options[:verbose]
$VERBOSE_LEVEL = 1
end
end
s = DirCat.loadfromfile( cat_filename )
puts s.send( command.to_sym )
end
|