Skip to content

Commit

Permalink
CLI: output help when unknown switches are used
Browse files Browse the repository at this point in the history
Fix issue pry#847 (Pry should output help when unknown flags are used)
  • Loading branch information
kyrylo committed Mar 12, 2013
1 parent eabe96d commit 0e34914
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/pry/cli.rb
Expand Up @@ -62,7 +62,19 @@ def parse_options(args=ARGV.dup)

self.input_args = args

opts = Slop.parse!(args, :help => true, :multiple_switches => false, &options)
begin
opts = Slop.parse!(
args,
:help => true,
:multiple_switches => false,
:strict => true,
&options
)
rescue Slop::InvalidOptionError
# Display help message on unknown switches and exit.
puts Slop.new(&options)
exit
end

# Option processors are optional.
if option_processors
Expand Down

0 comments on commit 0e34914

Please sign in to comment.