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

Array type does not obey OPTS_END #631

Open
jquick opened this issue Oct 29, 2018 · 0 comments
Open

Array type does not obey OPTS_END #631

jquick opened this issue Oct 29, 2018 · 0 comments

Comments

@jquick
Copy link

jquick commented Oct 29, 2018

Using the typical OPTS_END "--" after an array option type will not work as expected. Ex:

my_command --array 1 2 -- arg1 arg2

Updating https://github.com/erikhuda/thor/blob/master/lib/thor/parser/arguments.rb#L118 with:

    def parse_array(name)
      return shift if peek.is_a?(Array)
      array = []
      while current_is_value?
        break unless @parsing_options
        array << shift
      end

      array
    end

fixes this issue as the peek will set @parsing_options to false when it hits the OPTS_END

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

1 participant