Module: Ronin::Core::CLI::Options::Param

Defined in:
lib/ronin/core/cli/options/param.rb

Overview

Adds a -p,--param NAME=VALUE option for setting param values.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#paramsHash{Symbol => String} (readonly)

The set params.

Returns:

  • (Hash{Symbol => String})


51
52
53
# File 'lib/ronin/core/cli/options/param.rb', line 51

def params
  @params
end

Class Method Details

.included(command) ⇒ Object

Adds a -p,--param NAME=VALUE option to the command.

Parameters:



35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/ronin/core/cli/options/param.rb', line 35

def self.included(command)
  command.option :param, short: '-p',
                         value: {
                           type:  /\A[^=]+=.+\z/,
                           usage: 'NAME=VALUE'
                         },
                         desc: 'Sets a param' do |str|
                           name, value = str.split('=',2)

                           @params[name.to_sym] = value
                         end
end

Instance Method Details

#initialize(**kwargs) ⇒ Object

Initializes the command and #params.

Parameters:

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments.



59
60
61
62
63
# File 'lib/ronin/core/cli/options/param.rb', line 59

def initialize(**kwargs)
  super(**kwargs)

  @params = {}
end