summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyrylo Silin <kyrylosilin@gmail.com>2013-03-10 10:53:37 +0200
committerKyrylo Silin <kyrylosilin@gmail.com>2013-03-12 20:53:40 +0200
commit0e34914c8423179f09f61125aeb3146fb3a06e5a (patch)
treeefb25ffdeac664e26fd73738407f2b4dc6101912
parenteabe96d256234538dcd86a70d1aabab4d9214e71 (diff)
downloadpry-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.rb14
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