lib/cli/mastermind/arg_parse.rb
# Uses configured user aliases to perform command expansion.
#
# For example, an alias defined in a masterplan like so:
#
#     define_alias 'foo', 'foobar'
#
# when invoked like `mastermind foo` would operate as if the user had actually
# typed `mastermind foobar`.
#
# User aliases (defined in a masterplan) are much more powerful than planfile
# aliases (defined in a planfile).  Unlike planfile aliases, user aliases
# can define entire "plan stacks" and are recursively expanded.
#
# For example, the following aliases:
#
#     define_alias 'foo', 'foobar'
#     define_alias 'bar', 'foo sub'
#
# invoked as `mastermind bar` would operate as if the user had actually typed
# `mastermind foobar sub`.
#
# Plan arguments can also be specified in a user alias.  For example:
#
#     define_alias '2-add-2', 'calculator add -- 2 2'
#
# would expand as expected with the extra arguements (`'2 2'`) being passed
# into the executed plan.
#
# @param config [Configuration] the configuration object to use when expanding user aliases
# @return [Void]
Uses configured user aliases to perform command expansion.
For example, an alias defined in a masterplan like so.



when invoked like `mastermind foo` would operate as if the user had actually
typed `mastermind foobar`.

User aliases (defined in a masterplan) are much more powerful than planfile
aliases (defined in a planfile).  Unlike planfile aliases, user aliases
can define entire "plan stacks" and are recursively expanded.

For example, the following aliases.



invoked as `mastermind bar` would operate as if the user had actually typed
`mastermind foobar sub`.

Plan arguments can also be specified in a user alias.  For example.



would expand as expected with the extra arguements (`'2 2'`) being passed
into the executed plan.
Uses configured user aliases to perform command expansion . For example an alias defined in a masterplan like so . when invoked like ` mastermind foo ` would operate as if the user had actually typed ` mastermind foobar ` . User aliases ( defined in a masterplan ) are much more powerful than planfile aliases ( defined in a planfile ) . Unlike planfile aliases user aliases can define entire " plan stacks " and are recursively expanded . For example the following aliases . invoked as ` mastermind bar ` would operate as if the user had actually typed ` mastermind foobar sub ` . Plan arguments can also be specified in a user alias . For example . would expand as expected with the extra arguements ( ` ' 2 2 ' ` ) being passed into the executed plan .
def do_command_expansion!(config)
      @alias_arguments = []
      @mastermind_arguments.map! do |argument|
        expand_argument(config, argument)
      end
      @plan_arguments = @alias_arguments + @plan_arguments
      @mastermind_arguments.flatten!
      nil 
    end
def do_command_expansion! ( config ) @alias_arguments = [ ] @mastermind_arguments . map! do | argument | expand_argument ( config , argument ) end @plan_arguments = @alias_arguments + @plan_arguments @mastermind_arguments . flatten! nil end
Uses configured user aliases to perform command expansion.
Uses configured user aliases to perform command expansion .
# prevent @mastermind_arguments from leaking
None
Void
config
the configuration object to use when expanding user aliases
the configuration object to use when expanding user aliases