Class: Nauvisian::CLI::Commands::Mod::Enable

Inherits:
Dry::CLI::Command
  • Object
show all
Includes:
MessageHelper
Defined in:
lib/nauvisian/cli/commands/mod/enable.rb

Instance Method Summary collapse

Instance Method Details

#call(mod:, **options) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/nauvisian/cli/commands/mod/enable.rb', line 17

def call(mod:, **options)
  mod_directory = Pathname(options[:mod_directory])
  mod_list_path = mod_directory / "mod-list.json"
  list = Nauvisian::ModList.load(mod_list_path)
  mod = Nauvisian::Mod[name: mod]
  list.enable(mod)
  list.save(mod_list_path)
rescue Nauvisian::ModNotFound
  message "❌ You can't enable a MOD which is not in the MOD list (#{mod.name})"
  exit 1
end