Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slop doesn't parse correctly with multiple_switches #28

Closed
Mon-Ouie opened this issue Jun 13, 2011 · 0 comments
Closed

Slop doesn't parse correctly with multiple_switches #28

Mon-Ouie opened this issue Jun 13, 2011 · 0 comments

Comments

@Mon-Ouie
Copy link

Hi,

Using the multiple_switches feature, Slop doesn't work as expected. For example, with the following code where args is ["-mLv", "-C", "Ripper"] :

    opts = Slop.parse! args, :multiple_switches => true do
      on :v, :verbose, "Show value of variables and constants and locations of methods"
      on :L, :less, "Only show methods set by the receiver"
      on :a, :more, "Show all of the methods, including those defined in Object"
      on :f, :filter, "Regular expression to filter methods and variables",
        :optional => false, :default => ""
      on :C, :context, "Changes self", :optional => false do |arg|
        p arg
        ctxt.target = Pry.binding_for(target.eval(context))
      end

      on :l, :locals, "Show local variables"
      on :g, :globals, "Show global variables"
      on :i, 'instance-variables', "Show instance variables"
      on :k, 'class-variables', "Show class variables"

      on :c, :constants, "Show constants"

      on :m, :methods, "Show methods"
      on :M, 'instance-methods', "Show instance methods"

      on :h, :help, 'Print this help message', :tail => true
    end

args still contains the flags passed to Slop and the block passed to the context flag doesn't get called.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants