lib/cri/command_dsl.rb in cri-2.14.0 vs lib/cri/command_dsl.rb in cri-2.15.0

- old
+ new

@@ -124,11 +124,11 @@ def be_hidden @command.hidden = true end # Skips option parsing for the command. Allows option-like arguments to be - # passed in, avoiding the {Cri::OptionParser} validation. + # passed in, avoiding the {Cri::Parser} validation. # # @return [void] def skip_option_parsing @command.all_opts_as_args = true end @@ -168,16 +168,19 @@ alias opt option # Defines a new parameter for the command. # # @param [Symbol] name The name of the parameter - def param(name) + def param(name, transform: nil) if @command.explicitly_no_params? raise AlreadySpecifiedAsNoParams.new(name, @command) end - @command.parameter_definitions << Cri::ParamDefinition.new(name: name) + @command.parameter_definitions << Cri::ParamDefinition.new( + name: name, + transform: transform, + ) end def no_params if @command.parameter_definitions.any? raise AlreadySpecifiedWithParams.new(@command) @@ -203,11 +206,11 @@ # # @return [void] # # @deprecated # - # @see {#option} + # @see #option def required(short, long, desc, params = {}, &block) params = params.merge(argument: :required) option(short, long, desc, params, &block) end @@ -226,11 +229,11 @@ # @option params [Boolean] :hidden Whether or not the option should # be printed in the help output # # @return [void] # - # @see {#option} + # @see #option def flag(short, long, desc, params = {}, &block) params = params.merge(argument: :forbidden) option(short, long, desc, params, &block) end alias forbidden flag @@ -252,10 +255,10 @@ # # @return [void] # # @deprecated # - # @see {#option} + # @see #option def optional(short, long, desc, params = {}, &block) params = params.merge(argument: :optional) option(short, long, desc, params, &block) end