Class: Inspec::Plugin::V2::PluginType::CliCommand
- Defined in:
- lib/inspec/plugin/v2/plugin_types/cli.rb
Class Method Summary collapse
-
.register_with_thor ⇒ Object
Register the command group with Thor.
-
.subcommand_desc(usage_msg, desc_msg) ⇒ Object
Provide a description for the command group.
Instance Method Summary collapse
-
#initialize(args, options, config) ⇒ CliCommand
constructor
initalize log options for plugins.
Methods inherited from BaseCLI
default_options, detect, exec_options, exit_on_failure?, parse_reporters, profile_options, target_options, validate_reporters
Constructor Details
#initialize(args, options, config) ⇒ CliCommand
initalize log options for plugins
6 7 8 9 10 11 12 13 |
# File 'lib/inspec/plugin/v2/plugin_types/cli.rb', line 6 def initialize(args, , config) super(args, , config) = config.fetch(:class_options, nil) if Inspec::Log.init(['log_location']) if .key?('log_location') Inspec::Log.level = get_log_level(['log_level']) if .key?('log_level') end end |
Class Method Details
.register_with_thor ⇒ Object
Register the command group with Thor. This must be called on the implementation class AFTER the the cli_command activator has been called
27 28 29 30 31 32 33 34 35 |
# File 'lib/inspec/plugin/v2/plugin_types/cli.rb', line 27 def self.register_with_thor # Figure out my activator name (= subcommand group name) subcommand_name = Inspec::Plugin::V2::Registry.instance \ .find_activators(plugin_type: :cli_command, implementation_class: self) \ .first.activator_name.to_s # Register with Thor Inspec::InspecCLI.register(self, subcommand_name, @usage_msg, @desc_msg, {}) end |
.subcommand_desc(usage_msg, desc_msg) ⇒ Object
Provide a description for the command group.
20 21 22 23 |
# File 'lib/inspec/plugin/v2/plugin_types/cli.rb', line 20 def self.subcommand_desc(usage_msg, desc_msg) @usage_msg = usage_msg @desc_msg = desc_msg end |