mirror of
https://github.com/nishiki/botish.git
synced 2024-11-23 00:07:51 +00:00
check if option config file is set
This commit is contained in:
parent
2bb2525331
commit
ff48d7ecf6
1 changed files with 6 additions and 3 deletions
|
@ -24,18 +24,21 @@ require 'botish/botish'
|
||||||
options = {}
|
options = {}
|
||||||
|
|
||||||
OptionParser.new do |opts|
|
OptionParser.new do |opts|
|
||||||
opts.banner = 'Usage: botish --host irc.freenode.net --channel "test" [options]'
|
opts.banner = 'Usage: botish --config config.yml'
|
||||||
|
|
||||||
opts.on('-c', '--config PATH') do |path|
|
opts.on('-c', '--config PATH', 'Specify the config file') do |path|
|
||||||
options[:config_file] = path
|
options[:config_file] = path
|
||||||
end
|
end
|
||||||
|
|
||||||
opts.on('-h', '--help') do
|
opts.on('-h', '--help', 'Show this message') do
|
||||||
puts opts
|
puts opts
|
||||||
exit 0
|
exit 0
|
||||||
end
|
end
|
||||||
end.parse!
|
end.parse!
|
||||||
|
|
||||||
|
raise 'Config file option is missing!' unless options.key?(:config_file)
|
||||||
|
raise 'The config file doesn\'t exist' unless File.exist?(options[:config_file])
|
||||||
|
|
||||||
botish = Botish::Botish.new(options[:config_file])
|
botish = Botish::Botish.new(options[:config_file])
|
||||||
botish.connect
|
botish.connect
|
||||||
botish.listen
|
botish.listen
|
||||||
|
|
Loading…
Reference in a new issue