module MotherBrain::Cli::SubCommand

Generates SubCommands for Thor from motherbrain plugins or pieces of motherbrain plugins

Public Class Methods

new(object) click to toggle source

Generate a new SubCommand for Thor from a motherbrain plugin or component

@param [MB::Plugin, MB::Component] object

@raise [ArgumentError]

@return [SubCommand::Plugin, SubCommand::Component]

# File lib/mb/cli/sub_command.rb, line 16
def new(object)
  case object
  when MB::Plugin
    SubCommand::Plugin.fabricate(object)
  when MB::Component
    SubCommand::Component.fabricate(object)
  else
    raise ::ArgumentError, "don't know how to fabricate a subcommand for a '#{object.class}'"
  end
end