Skip to content

Array type does not obey OPTS_END #631

@jquick

Description

@jquick

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions