Class: OmniAI::CLI::BaseHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/omniai/cli/base_handler.rb

Overview

A generic handler for CLI commands (e.g. ‘omniai chat’).

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stdin: $stdin, stdout: $stdout, provider: "openai") ⇒ BaseHandler



18
19
20
21
22
23
# File 'lib/omniai/cli/base_handler.rb', line 18

def initialize(stdin: $stdin, stdout: $stdout, provider: "openai")
  @stdin = stdin
  @stdout = stdout
  @provider = provider
  @args = {}
end

Class Method Details

.handle!(argv:, stdin: $stdin, stdout: $stdout, provider: "openai") ⇒ Object



11
12
13
# File 'lib/omniai/cli/base_handler.rb', line 11

def self.handle!(argv:, stdin: $stdin, stdout: $stdout, provider: "openai")
  new(stdin:, stdout:, provider:).handle!(argv:)
end

Instance Method Details

#handle!(argv:) ⇒ Object

Raises:

  • (NotImplementedError)


26
27
28
# File 'lib/omniai/cli/base_handler.rb', line 26

def handle!(argv:)
  raise NotImplementedError, "#{self.class}#handle! undefined"
end