Class: Llmemory::Cli::Commands::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/llmemory/cli/commands/base.rb

Instance Method Summary collapse

Instance Method Details

#execute(_argv, _opts) ⇒ Object

Raises:

  • (NotImplementedError)


22
23
24
# File 'lib/llmemory/cli/commands/base.rb', line 22

def execute(_argv, _opts)
  raise NotImplementedError, "#{self.class}#execute must be implemented"
end

#option_parser(parser) ⇒ Object



18
19
20
# File 'lib/llmemory/cli/commands/base.rb', line 18

def option_parser(parser)
  # Override in subclasses to add options
end

#parse_options(argv) ⇒ Object



12
13
14
15
16
# File 'lib/llmemory/cli/commands/base.rb', line 12

def parse_options(argv)
  OptionParser.new do |opts|
    option_parser(opts)
  end.parse!(argv)
end

#run(argv) ⇒ Object



7
8
9
10
# File 'lib/llmemory/cli/commands/base.rb', line 7

def run(argv)
  opts = parse_options(argv)
  execute(argv, opts)
end