Module: MotherBrain::Cli::SubCommand

Defined in:
lib/mb/cli/sub_command.rb,
lib/mb/cli/sub_command/plugin.rb,
lib/mb/cli/sub_command/component.rb

Overview

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

Defined Under Namespace

Classes: Base, Component, Plugin

Class Method Summary collapse

Class Method Details

.new(object) ⇒ SubCommand::Plugin, SubCommand::Component

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

Parameters:

Returns:

Raises:



16
17
18
19
20
21
22
23
24
25
# 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