Class: LLM::Repl::Help

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

Instance Method Summary collapse

Methods inherited from Command

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

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
21
22
# File 'lib/llm/repl/commands/help.rb', line 12

def call(name: nil)
  if name.nil?
    write("\n#{self.class.help}\n\n")
  elsif command = LLM::Command.find_by(name:)
    write("\n#{command.help}\n\n")
  else
    write "\nNo help for #{name} was found" \
          "\nThat command doesn't exist." \
          "\n\n"
  end
end