Class: WritersRoom::Commands::Config

Inherits:
Thor
  • Object
show all
Defined in:
lib/writers_room/cli/config.rb

Instance Method Summary collapse

Instance Method Details

#configObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/writers_room/cli/config.rb', line 10

def config
  config_path = File.join(Dir.pwd, "config.yml")

  unless File.exist?(config_path)
    say "No config.yml found in current directory.", :yellow
    say "Run 'wr init <project_name>' to create a new project.", :yellow
    exit 1
  end

  config = WritersRoom::Config.new(config_path)
  say "Configuration (#{config_path}):", :cyan
  say "  Provider:   #{config.provider}", :white
  say "  Model:      #{config.model_name}", :white
rescue StandardError => e
  say "Error reading configuration: #{e.message}", :red
  exit 1
end