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
59
60
61
62
63
64
|
# File 'lib/console.rb', line 26
def parse_opts(argv = ARGV)
options = {}
options[:start_anvil] = true
opts = OptionParser.new do |opts|
opts.banner = "Usage: anvil [gih] [argument]"
opts.define_head "Anvil GUI framework."
opts.separator '*'*80
opts.separator 'If no flags are given, Anvil starts in the foreground'
opts.separator '*'*80
opts.on("-i", "--irb-console", "This flag will start Anvil in irb console. Your application models and classes will be loaded and available through console.") do |console|
options[:console] = true
options[:start_anvil] = false
puts "Coming Soon!"
end
opts.on("-g", "--generate-app PATH", "Generate a fresh Anvil application at PATH") do |path|
options[:generate] = path || Dir.pwd
options[:start_anvil] = false
end
opts.on("-?", "-h", "--help", "Show this help message") do
puts opts
exit
end
end
opts.parse!(argv)
if argv.size == 1
options[:generate] = File.expand_path(argv.last)
options[:start_anvil] = false
end
@@anvil_opts = options
end
|