lib/cli/mastermind/arg_parse.rb
# Performs alias expansion using the provided configuration object
#
# @param config [Configuration] the configuration object used to perform expansion
# @param argument [String] the argument to be expanded
#
# @return [Array<String>, String] the expanded arguments
Performs alias expansion using the provided configuration object
Performs alias expansion using the provided configuration object
def expand_argument(config, argument)
      dealiased = config.map_alias(argument)
      if dealiased.is_a? Array
        partitioned = dealiased.slice_before('--').to_a
        plan_names = partitioned.shift.map { |arg|  expand_argument(config, arg) }.flatten
        plan_arguments = partitioned.shift
        if plan_arguments
          plan_arguments.shift 
          @alias_arguments.concat plan_arguments
        end
        dealiased = plan_names
      end
      dealiased
    end
def expand_argument ( config , argument ) dealiased = config . map_alias ( argument ) if dealiased . is_a? Array partitioned = dealiased . slice_before ( '--' ) . to_a plan_names = partitioned . shift . map { | arg | expand_argument ( config , arg ) } . flatten plan_arguments = partitioned . shift if plan_arguments plan_arguments . shift @alias_arguments . concat plan_arguments end dealiased = plan_names end dealiased end
Performs alias expansion using the provided configuration object
Performs alias expansion using the provided configuration object
# Recursively expand plan names # NOTE: This does not defend against circular dependencies! # removes the --
the expanded arguments
the expanded arguments
Array<String>, String
config
the configuration object used to perform expansion
the configuration object used to perform expansion
argument
the argument to be expanded
the argument to be expanded