Permalink
Browse files

add strict mode / rescue example to README

  • Loading branch information...
squarism committed Oct 7, 2014
1 parent 4050e47 commit 380672e6e96e58a34905b9a2c07c8a35b41d7ae9
Showing with 17 additions and 0 deletions.
  1. +17 −0 README.md
View
@@ -93,6 +93,23 @@ opts[:range] #=> 1..10
opts[:range] #=> 1..10
```
Strict Flags
------------
If you want to print `--help` automatically when a required flag is left out, you can rescue `Slop::Error` like so:
```
opts = Slop.new strict: true do
# options here...
end
begin
opts.parse
rescue Slop::Error => e
puts e.message
puts opts # print help
end
```
Autocreate
----------

0 comments on commit 380672e

Please sign in to comment.