Skip to content

Commit

Permalink
Fix bin/kpeg when there are no arguments passed in
Browse files Browse the repository at this point in the history
  • Loading branch information
sjothen committed Dec 22, 2013
1 parent 818e25b commit 6dd0b37
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions bin/kpeg
Expand Up @@ -8,7 +8,7 @@ require 'kpeg/grammar_renderer'
require 'optparse'

options = {}
OptionParser.new do |o|
optparser = OptionParser.new do |o|
o.banner = "Usage: kpeg [options]"

o.on("-t", "--test", "Syntax check the file only") do |v|
Expand Down Expand Up @@ -42,7 +42,14 @@ OptionParser.new do |o|
o.on("-d", "--debug", "Debug parsing the file") do |v|
options[:debug] = v
end
end.parse!
end

optparser.parse!

if ARGV.empty?
puts optparser.help
exit 1
end

file = ARGV.shift

Expand Down

0 comments on commit 6dd0b37

Please sign in to comment.