42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
# File 'lib/neko/cli/application.rb', line 42
def parse_options
begin
opts = OptionParser.new do |opt|
opt.banner = "#{APP_NAME} v#{VERSION}\n#{AUTHOR}\n#{WEB_SITE}\n\n"
opt.banner << "Usage: #{APP_NAME} [options] [files_to_parse]"
opt.separator ''
opt.separator 'Other Options'
opt.on_tail('-v', '--version', 'Shows application version information') do
puts "#{APP_NAME} - #{VERSION}"
exit
end
opt.on('-d', '--debug', 'Enable debug mode (More verbose output)') do
puts "#{APP_NAME} - #{VERSION}"
exit
end
opt.on_tail('-?', '--help', 'Show this message') do
puts opt.to_s + "\n"
exit
end
end
if ARGV.length != 0
opts.parse!
else
puts opts.to_s + "\n"
exit
end
rescue OptionParser::MissingArgument => m
puts opts.to_s + "\n"
exit
rescue OptionParser::InvalidOption => i
puts opts.to_s + "\n"
exit
end
end
|