diff options
author | Lee Jarvis <lee@jarvis.co> | 2011-07-07 14:50:11 +0100 |
---|---|---|
committer | Lee Jarvis <lee@jarvis.co> | 2011-07-07 14:50:11 +0100 |
commit | df27a36d6b4e56f670e6c49dca2e7a674079711a (patch) | |
tree | da8586f771b6e32a0428079632538bd702d1f264 /README.md | |
parent | 061bc689957f7046d2b06e1cf82b211b9c157463 (diff) | |
download | slop-df27a36d6b4e56f670e6c49dca2e7a674079711a.tar.gz |
updated README examples
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 17 |
1 files changed, 12 insertions, 5 deletions
@@ -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 ----- |