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
-
#params ⇒ Hash{Symbol => String}
readonly
The set params.
Class Method Summary collapse
-
.included(command) ⇒ Object
Adds a
-p,--param NAME=VALUE
option to the command.
Instance Method Summary collapse
-
#initialize(**kwargs) ⇒ Object
Initializes the command and #params.
Instance Attribute Details
#params ⇒ Hash{Symbol => String} (readonly)
The set params.
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.
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.
59 60 61 62 63 |
# File 'lib/ronin/core/cli/options/param.rb', line 59 def initialize(**kwargs) super(**kwargs) @params = {} end |