diff options
author | Kyrylo Silin <kyrylosilin@gmail.com> | 2013-03-10 10:53:37 +0200 |
---|---|---|
committer | Kyrylo Silin <kyrylosilin@gmail.com> | 2013-03-12 20:53:40 +0200 |
commit | 0e34914c8423179f09f61125aeb3146fb3a06e5a (patch) | |
tree | efb25ffdeac664e26fd73738407f2b4dc6101912 | |
parent | eabe96d256234538dcd86a70d1aabab4d9214e71 (diff) | |
download | pry-0e34914c8423179f09f61125aeb3146fb3a06e5a.tar.gz |
CLI: output help when unknown switches are used
Fix issue #847 (Pry should output help when unknown flags are used)
-rw-r--r-- | lib/pry/cli.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/pry/cli.rb b/lib/pry/cli.rb index 610760e1..e0bcaa0b 100644 --- a/lib/pry/cli.rb +++ b/lib/pry/cli.rb @@ -62,7 +62,19 @@ class Pry 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 |