Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Slop cannot parse fuzzy options with arguments correctly #74

Closed
kyrylo opened this Issue · 0 comments

2 participants

@kyrylo

By "fuzzy options with arguments", in actual fact, I mean a presence of space between a flag and its option. Let me show some examples:

def slop
  Slop.new(:multiple_switches => false) do
    on :r, :argument => true
    on :I, :argument => true
  end
end

# Broken.
opts = slop
opts.parse %w( -Ilib -rgeronimo )
p opts[:I] # => "lib"
p opts[:r] # => nil

# Broken.
opts = slop
opts.parse %w( -Ilib -r geronimo )
p opts[:I] # => "lib"
p opts[:r] # => nil

# Works!
opts = slop
opts.parse %w( -I lib -r geronimo )
p opts[:I] # => "lib"
p opts[:r] # => "geronimo"

# Works!
opts = slop
opts.parse %w( -I lib -rgeronimo )
p opts[:I] # => "lib"
p opts[:r] # => "geronimo"
@leejarvis leejarvis closed this issue from a commit
Lee Jarvis ensure options are not swallowed when using options with arguments in…
…cluded in value

closes #74
9494584
@leejarvis leejarvis closed this in 9494584
@ghost Unknown referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@sideci-sample sideci-sample referenced this issue from a commit in sideci-sample/sideci-sample-pry
@kyrylo kyrylo Improve `-I` option support
Namely, add support for multiple arguments for the `-I` option. For
example:

  % pry -Ilib:../code/src

Where `:` is the delimiter for paths. In the example above `./lib` and
`../code/src` directories will be added to $LOAD_PATH array.

Also, there was a bug in Slop with respect to parsing of "fuzzy options
with arguments"[1]. It is fixed now, so the next version of Slop will
indirectly resolve our issue #674 (-r/--require doesn't behave like
irb's)[2].

And finally, wrap some very long lines in the "cli.rb" (this is just a
cosmetic change).

[1]: leejarvis/slop#74
[2]: pry/pry#674

Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
2e33c98
@strcmp strcmp referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.