Class: Stylegen::CLI::Commands::Init

Inherits:
Dry::CLI::Command
  • Object
show all
Defined in:
lib/stylegen/cli/commands.rb

Instance Method Summary collapse

Instance Method Details

#call(output: 'theme.yaml') ⇒ Object

Raises:



32
33
34
35
36
37
38
39
# File 'lib/stylegen/cli/commands.rb', line 32

def call(output: 'theme.yaml', **)
  raise Error, "'#{output}' already exists." if File.exist?(output)

  template = File.read(File.join(__dir__, 'template.yaml'))
  File.write(output, template)

  puts "Generated '#{output}'."
end