Class: Factorix::CLI::Commands::MOD::Image::Add
- Inherits:
-
Base
- Object
- Dry::CLI::Command
- Base
- Factorix::CLI::Commands::MOD::Image::Add
- Includes:
- PortalSupport
- Defined in:
- lib/factorix/cli/commands/mod/image/add.rb,
sig/factorix/cli/commands/mod/image/add.rbs
Overview
Add an image to a MOD on Factorio MOD Portal
Instance Attribute Summary collapse
-
#portal ⇒ Portal
readonly
Returns the value of attribute portal.
Instance Method Summary collapse
-
#call(mod_name:, image_file:) ⇒ void
Execute the add command.
Methods inherited from Base
backup_support!, confirmable!, inherited, require_game_stopped!
Instance Attribute Details
#portal ⇒ Portal (readonly)
Returns the value of attribute portal.
11 12 13 |
# File 'sig/factorix/cli/commands/mod/image/add.rbs', line 11 def portal @portal end |
Instance Method Details
#call(mod_name:, image_file:) ⇒ void
This method returns an undefined value.
Execute the add command
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 |