Module: BruteCLI::ToolOutput

Defined in:
lib/brute_cli/tool_output.rb,
lib/brute_cli/tool_output/read.rb,
lib/brute_cli/tool_output/undo.rb,
lib/brute_cli/tool_output/fetch.rb,
lib/brute_cli/tool_output/patch.rb,
lib/brute_cli/tool_output/shell.rb,
lib/brute_cli/tool_output/write.rb,
lib/brute_cli/tool_output/remove.rb,
lib/brute_cli/tool_output/delegate.rb,
lib/brute_cli/tool_output/question.rb,
lib/brute_cli/tool_output/fs_search.rb,
lib/brute_cli/tool_output/todo_read.rb,
lib/brute_cli/tool_output/todo_write.rb

Defined Under Namespace

Classes: Base, Delegate, Fetch, FsSearch, Patch, Question, Read, Remove, Shell, TodoRead, TodoWrite, Undo, Write

Constant Summary collapse

MAP =
{
  "read"       => Read,
  "write"      => Write,
  "patch"      => Patch,
  "shell"      => Shell,
  "fs_search"  => FsSearch,
  "fetch"      => Fetch,
  "remove"     => Remove,
  "undo"       => Undo,
  "delegate"   => Delegate,
  "question"   => Question,
  "todo_read"  => TodoRead,
  "todo_write" => TodoWrite,
}.freeze

Class Method Summary collapse

Class Method Details

.for(name:, args: {}, width: 80) ⇒ Object

Build a ToolOutput instance by name.



61
62
63
64
# File 'lib/brute_cli/tool_output.rb', line 61

def self.for(name:, args: {}, width: 80)
  klass = MAP[name.to_s] || Base
  klass.new(name: name, args: args, width: width)
end

.icon_for(name) ⇒ Object

Just the icon for a given tool name.



67
68
69
70
# File 'lib/brute_cli/tool_output.rb', line 67

def self.icon_for(name)
  klass = MAP[name.to_s] || Base
  klass::ICON
end