summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorLee Jarvis <lee@jarvis.co>2011-07-07 14:50:11 +0100
committerLee Jarvis <lee@jarvis.co>2011-07-07 14:50:11 +0100
commitdf27a36d6b4e56f670e6c49dca2e7a674079711a (patch)
treeda8586f771b6e32a0428079632538bd702d1f264 /README.md
parent061bc689957f7046d2b06e1cf82b211b9c157463 (diff)
downloadslop-df27a36d6b4e56f670e6c49dca2e7a674079711a.tar.gz
updated README examples
Diffstat (limited to 'README.md')
-rw-r--r--README.md17
1 files changed, 12 insertions, 5 deletions
diff --git a/README.md b/README.md
index 2152d9b..a7c647c 100644
--- a/README.md
+++ b/README.md
@@ -160,22 +160,29 @@ Short Switches
--------------
Want to enable multiple switches at once like rsync does? By default Slop will
-parse `-abcd` as the option `a` with the argument `bcd`, this can be disabled
-by passing the `:multiple_switches` option to a new Slop object.
+parse `-abc` as the options `a` `b` and `c` and set their values to true. If
+you would like to disable this, you can pass `multiple_switches => false` to
+a new Slop object. In which case Slop will then parse `-fbar` as the option
+`f` with the argument value `bar`.
- opts = Slop.new(:strict, :multiple_switches) do
+ Slop.parse do
on :a, 'First switch'
on :b, 'Second switch'
on :c, 'Third switch'
end
- opts.parse
-
# Using `-ac`
opts[:a] #=> true
opts[:b] #=> false
opts[:c] #=> true
+ Slop.parse(:multiple_switches => false) do
+ on :a, 'Some switch', true
+ end
+
+ # Using `ahello`
+ opts[:a] #=> 'hello'
+
Lists
-----