Class: BruteCLI::CLI::Commands::Chat

Inherits:
Dry::CLI::Command
  • Object
show all
Defined in:
lib/brute_cli/cli/commands/chat.rb

Instance Method Summary collapse

Instance Method Details

#call(prompt: nil, **options) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/brute_cli/cli/commands/chat.rb', line 18

def call(prompt: nil, **options)
  opts = {}
  opts[:session_id] = options[:session] if options[:session]

  if options[:directory]
    Dir.chdir(options[:directory])
  end

  if prompt
    # Single-shot mode: run the prompt and exit.
    Execution.new(opts).run(prompt)
  else
    # Interactive REPL mode.
    REPL.new(opts).run
  end
end