Class: Nauvisian::CLI::Commands::Mod::Installed

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

Instance Method Summary collapse

Instance Method Details

#call(**options) ⇒ Object



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

def call(*, **options)
  mod_directory = Pathname(options[:mod_directory])
  mod_list_path = mod_directory / "mod-list.json"
  mods = Nauvisian::ModList.load(mod_list_path).sort
  rows = mods.map {|mod, enabled| {"Name" => mod.name, "Enabled" => enabled} }

  lister = Nauvisian::CLI::Lister.for(options[:format].to_sym).new(%w(Name Enabled))
  lister.list(rows)
rescue => e
  message(e)
  exit 1
end