Class: LLM::Repl::Help

Inherits:
Command show all
Defined in:
lib/llm/repl/commands/help.rb

Instance Attribute Summary

Attributes inherited from Command

#agent, #repl

Instance Method Summary collapse

Methods inherited from Command

complete, description, find_by, help, inherited, #initialize, name, parameter, parameters, #parameters, registry, required, #write, #write_message

Constructor Details

This class inherits a constructor from LLM::Repl::Command

Instance Method Details

#call(name: nil) ⇒ void

This method returns an undefined value.

Parameters:

  • name (String) (defaults to: nil)


12
13
14
15
16
17
18
19
20
# File 'lib/llm/repl/commands/help.rb', line 12

def call(name: nil)
  if name.nil?
    write(self.class.help)
  elsif command = LLM::Command.find_by(name:)
    write(command.help)
  else
    write "no help for #{name} was found"
  end
end