Class: Nauvisian::CLI::Commands::Mod::Download

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

Instance Method Summary collapse

Instance Method Details

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



20
21
22
23
24
25
26
27
28
29
# File 'lib/nauvisian/cli/commands/mod/download.rb', line 20

def call(mod:, **options)
  credential = find_credential(**options.slice(:user, :token))
  release = find_release(Nauvisian::Mod[name: mod], version: options.key?(:version) ? Nauvisian::Version24[options[:version]] : nil)

  downloader = Nauvisian::Downloader.new(credential:, progress: Nauvisian::Progress::Bar)
  downloader.download(release, release.file_name)
rescue => e
  message(e)
  exit 1
end