class Bundler::Thor::Options
def parse(args) # rubocop:disable Metrics/MethodLength
def parse(args) # rubocop:disable Metrics/MethodLength @pile = args.dup @is_treated_as_value = false @parsing_options = true while peek if parsing_options? match, is_switch = current_is_switch? shifted = shift if is_switch case shifted when SHORT_SQ_RE unshift($1.split("").map { |f| "-#{f}" }) next when EQ_RE unshift($2, is_value: true) switch = $1 when SHORT_NUM unshift($2) switch = $1 when LONG_RE, SHORT_RE switch = $1 end switch = normalize_switch(switch) option = switch_option(switch) result = parse_peek(switch, option) assign_result!(option, result) elsif @stop_on_unknown @parsing_options = false @extra << shifted @stopped_parsing_after_extra_index ||= @extra.size @extra << shift while peek break elsif match @extra << shifted @extra << shift while peek && peek !~ /^-/ else @extra << shifted end else @extra << shift end end check_requirement! unless @disable_required_check check_exclusive! check_at_least_one! assigns = Bundler::Thor::CoreExt::HashWithIndifferentAccess.new(@assigns) assigns.freeze assigns end