Class: Factorix::CLI::Commands::MOD::Edit

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

Overview

Edit MOD metadata 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:, description: nil, summary: nil, title: nil, category: nil, tags: nil, license: nil, homepage: nil, source_url: nil, faq: nil, deprecated: nil) ⇒ void

This method returns an undefined value.

Execute the edit command

Parameters:

  • mod_name (String)

    the MOD name

  • description (String, nil) (defaults to: nil)

    optional description

  • summary (String, nil) (defaults to: nil)

    optional summary

  • title (String, nil) (defaults to: nil)

    optional title

  • category (String, nil) (defaults to: nil)

    optional category

  • tags (Array<String>, nil) (defaults to: nil)

    optional tags

  • license (String, nil) (defaults to: nil)

    optional license

  • homepage (String, nil) (defaults to: nil)

    optional homepage

  • source_url (String, nil) (defaults to: nil)

    optional source URL

  • faq (String, nil) (defaults to: nil)

    optional FAQ

  • deprecated (Boolean, nil) (defaults to: nil)

    optional deprecation flag



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/factorix/cli/commands/mod/edit.rb', line 45

def call(mod_name:, description: nil, summary: nil, title: nil, category: nil, tags: nil, license: nil, homepage: nil, source_url: nil, faq: nil, deprecated: nil, **)
  validate_license!(license) if license

   = (
    description:,
    summary:,
    title:,
    category:,
    tags:,
    license:,
    homepage:,
    source_url:,
    faq:,
    deprecated:
  )

  if .empty?
    say "At least one metadata option must be provided", prefix: :error
    say "Available options: --description, --summary, --title, --category, --tags, --license, --homepage, --source-url, --faq, --deprecated"
    raise InvalidArgumentError, "No metadata options provided"
  end

  portal.edit_mod(mod_name, **)
  say "Metadata updated successfully!", prefix: :success
end