Class: Chagall::Cli

Inherits:
Clamp::Command
  • Object
show all
Defined in:
lib/chagall/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.options_from_config_fileObject



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/chagall/cli.rb', line 19

def self.options_from_config_file
  @options_from_config_file ||= begin
    config_path = File.join(Dir.pwd, "chagall.yml") || File.join(Dir.pwd, "chagall.yaml")
    return {} unless File.exist?(config_path)

    config = YAML.load_file(config_path)
    config.transform_keys(&:to_sym)
  rescue StandardError => e
    puts "Warning: Error loading chagall.yml: #{e.message}"
    {}
  end
end

Instance Method Details

#run(arguments) ⇒ Object



13
14
15
16
17
# File 'lib/chagall/cli.rb', line 13

def run(arguments)
  parse(arguments)
  Chagall::Settings.configure(collect_options_hash)
  execute
end