diff options
author | Lee Jarvis <lee@jarvis.co> | 2011-04-12 22:08:26 +0100 |
---|---|---|
committer | Lee Jarvis <lee@jarvis.co> | 2011-04-12 22:08:26 +0100 |
commit | f8c705619de72257a61134fdbe6c724b5f7835e5 (patch) | |
tree | a576cca7194bc7e730ce43dab8e85215bdb6e59d /README.md | |
parent | ffddd1457e3f252923c46798e4fd20e1789877ee (diff) | |
download | slop-f8c705619de72257a61134fdbe6c724b5f7835e5.tar.gz |
move "Lists" header a little higher
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 42 |
1 files changed, 21 insertions, 21 deletions
@@ -196,6 +196,27 @@ by passing the `:multiple_switches` option to a new Slop object. opts[:b] #=> false opts[:c] #=> true +Lists +----- + +You can of course also parse lists into options. Here's how: + + opts = Slop.parse do + opt :people, true, :as => Array + end + + # ARGV is `--people lee,john,bill` + opts[:people] #=> ['lee', 'john', 'bill'] + +You can also change both the split delimiter and limit + + opts = Slop.parse do + opt :people, true, :as => Array, :delimiter => ':', :limit => 2) + end + + # ARGV is `--people lee:injekt:bob` + opts[:people] #=> ["lee", "injekt:bob"] + Ugh, Symbols ------------ @@ -238,27 +259,6 @@ You can also try other variations: on :n, :name on :name, true -Lists ------ - -You can of course also parse lists into options. Here's how: - - opts = Slop.parse do - opt :people, true, :as => Array - end - - # ARGV is `--people lee,john,bill` - opts[:people] #=> ['lee', 'john', 'bill'] - -You can also change both the split delimiter and limit - - opts = Slop.parse do - opt :people, true, :as => Array, :delimiter => ':', :limit => 2) - end - - # ARGV is `--people lee:injekt:bob` - opts[:people] #=> ["lee", "injekt:bob"] - Strict Mode ----------- |