7
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
|
# File 'lib/werk/cli.rb', line 7
def self.order!(args)
options = {}
optparse = OptionParser.new do |opts|
opts.banner = "Usage: werk [options] <command> [arguments]"
opts.on( '-f', '--rcfile FILE', 'Load the specified werkrc file (in lieu of .werkrc files)' ) do |file|
options[:rcfile] = file
end
opts.on( '-v', '--verbose', 'Be verbose' ) do
options[:verbose] = true
end
opts.on( '-h', '--help', 'Display this screen' ) do
puts opts
exit
end
end
begin
optparse.order!(args)
raise "You need to specify a command" if args.empty?
rescue
puts $!
puts optparse
exit
end
options
end
|