lib/itch_rewards/cli.rb in itch_rewards-0.1.1 vs lib/itch_rewards/cli.rb in itch_rewards-0.1.2
- old
+ new
@@ -112,11 +112,11 @@
if !File.exist? config_path
result = cli.yes?("Config file #{config_path} does not exist, would you like to create it?")
if result
- write_config(config_path)
+ Rewards.write_config(config_path, options)
cli.say "Config file written to #{config_path}"
end
else
cli.warn "Config file #{config_path} already exists, skipping..."
end
@@ -146,12 +146,12 @@
cli.say "Rewards for #{game.name} (id: #{game.id})"
table = objects_to_table(game.rewards.list)
cli.say render_table(table)
end
- def self.write_config(path)
+ def self.write_config(path, options)
require 'erb'
- client = authenticated_client!
+ client = authenticated_client!(options)
games = client.game_map.map.values
template = File.read(File.join(__dir__, 'templates/reward_config.yml.erb'))
File.write(options[:config], ERB.new(template, trim_mode: '-').result(binding))