fix option checking
This commit is contained in:
parent
c5d8636c65
commit
a6acfd99fc
1 changed files with 10 additions and 8 deletions
|
|
@ -53,7 +53,6 @@ def save_file(dir, name, data)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
# meuh, dit werkt nu niet :( mag dit wel in een def staan?
|
|
||||||
def parse_options(options)
|
def parse_options(options)
|
||||||
begin
|
begin
|
||||||
opts = GetoptLong.new(
|
opts = GetoptLong.new(
|
||||||
|
|
@ -72,17 +71,20 @@ def parse_options(options)
|
||||||
opts.each do |opt, arg|
|
opts.each do |opt, arg|
|
||||||
options[opt] = arg
|
options[opt] = arg
|
||||||
end
|
end
|
||||||
rescue
|
rescue GetoptLong::InvalidOption
|
||||||
print "#{opts.error_message}\n"
|
print "#{$!}\n"
|
||||||
print "\nUsage:\n"
|
usage
|
||||||
exit
|
|
||||||
end
|
end
|
||||||
#print opts.error_message
|
|
||||||
#print "Remaining args: #{ARGV.join(', ')}\n"
|
|
||||||
|
|
||||||
return options
|
return options
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def usage
|
||||||
|
print "\nUsage:\n"
|
||||||
|
print "blabla hier nog iets verzinnen\n"
|
||||||
|
exit
|
||||||
|
end
|
||||||
|
|
||||||
def parse_config(default = {})
|
def parse_config(default = {})
|
||||||
file = File.new("#{default[\"-c\"]}")
|
file = File.new("#{default[\"-c\"]}")
|
||||||
lines = file.readlines
|
lines = file.readlines
|
||||||
|
|
@ -325,7 +327,7 @@ for group in @config.keys.sort
|
||||||
mode, filename, body = get_multi(i, group)
|
mode, filename, body = get_multi(i, group)
|
||||||
end
|
end
|
||||||
output_data(i, mode, filename, body) if mode != false
|
output_data(i, mode, filename, body) if mode != false
|
||||||
rescue Article::BodyError
|
rescue Article::TempError
|
||||||
print "Skipping article...\n"
|
print "Skipping article...\n"
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue