Module: Hyrum

Defined in:
lib/hyrum.rb,
lib/hyrum/version.rb,
lib/hyrum/script_options.rb,
lib/hyrum/formats/formatter.rb,
lib/hyrum/generators/fake_generator.rb,
lib/hyrum/generators/openai_generator.rb,
lib/hyrum/generators/message_generator.rb

Defined Under Namespace

Modules: Formats, Generators Classes: ScriptOptions, ScriptOptionsError

Constant Summary collapse

VERSION =
'0.1.0'

Class Method Summary collapse

Class Method Details

.run(args) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/hyrum.rb', line 9

def self.run(args)
  options = ScriptOptions.new(args).parse
  generator_opts = options.slice(:message, :key, :ai_service, :ai_model, :number, :verbose)
  formatter_opts = options.slice(:format, :verbose)

  puts "Options: #{options.inspect}" if options[:verbose]
  formatter = Formats::Formatter.new(formatter_opts)
  message_generator = Generators::MessageGenerator.create(generator_opts)
  messages = message_generator.generate
  output = formatter.format(messages)
  puts output
rescue ScriptOptionsError => e
  puts e.message
  exit
end