Class: Factorix::CLI::Commands::MOD::Image::Add

Inherits:
Base
  • Object
show all
Includes:
PortalSupport
Defined in:
lib/factorix/cli/commands/mod/image/add.rb

Overview

Add an image to a MOD on Factorio MOD Portal

Instance Method Summary collapse

Methods inherited from Base

backup_support!, confirmable!, inherited, require_game_stopped!

Instance Method Details

#call(mod_name:, image_file:) ⇒ void

This method returns an undefined value.

Execute the add command

Parameters:

  • mod_name (String)

    the MOD name

  • image_file (String)

    path to image file

Raises:



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/factorix/cli/commands/mod/image/add.rb', line 26

def call(mod_name:, image_file:, **)
  file_path = Pathname(image_file)

  raise InvalidArgumentError, "Image file not found: #{image_file}" unless file_path.exist?

  # Add image via Portal
  image = portal.add_mod_image(mod_name, file_path)

  say "Image added successfully!", prefix: :success
  say "  ID: #{image.id}"
  say "  Thumbnail: #{image.thumbnail}"
  say "  Full URL: #{image.url}"
end