Class: Factorix::CLI::Commands::MOD::Search

Inherits:
Base show all
Includes:
PortalSupport
Defined in:
lib/factorix/cli/commands/mod/search.rb,
sig/factorix/cli/commands/mod/search.rbs

Overview

Search MODs on Factorio MOD Portal

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

backup_support!, confirmable!, inherited, require_game_stopped!

Instance Attribute Details

#portal ⇒ Portal (readonly)

Returns the value of attribute portal.

Returns:



10
11
12
# File 'sig/factorix/cli/commands/mod/search.rbs', line 10

def portal
  @portal
end

#runtime ⇒ Runtime (readonly)

Returns the value of attribute runtime.

Returns:



11
12
13
# File 'sig/factorix/cli/commands/mod/search.rbs', line 11

def runtime
  @runtime
end

Instance Method Details

#call(mod_names: [], hide_deprecated: true, page: "1", page_size: "25", sort: nil, sort_order: nil, version: nil, json: false) ⇒ void

This method returns an undefined value.

Execute the search command

Parameters:

  • mod_names (Array<String>) (defaults to: []) —

    MOD names to search

  • hide_deprecated (Boolean) (defaults to: true) —

    Hide deprecated MODs

  • page (Integer) (defaults to: "1") —

    Page number

  • page_size (Integer) (defaults to: "25") —

    Results per page

  • sort (String, nil) (defaults to: nil) —

    Sort field

  • sort_order (String, nil) (defaults to: nil) —

    Sort order

  • version (String, nil) (defaults to: nil) —

    Factorio version filter

  • json (Boolean) (defaults to: false) —

    Output in JSON format

  • mod_names: (Array[String]) (defaults to: [])
  • hide_deprecated: (Boolean) (defaults to: true)
  • page: (Integer) (defaults to: "1")
  • page_size: (Integer) (defaults to: "25")
  • sort: (String, nil) (defaults to: nil)
  • sort_order: (String, nil) (defaults to: nil)
  • version: (String, nil) (defaults to: nil)
  • json: (Boolean) (defaults to: false)


49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/factorix/cli/commands/mod/search.rb', line 49

def call(mod_names: [], hide_deprecated: true, page: "1", page_size: "25", sort: nil, sort_order: nil, version: nil, json: false, **)
  page = Integer(page)
  page_size = Integer(page_size)
  version ||= default_factorio_version

  mods = portal.list_mods(*mod_names, hide_deprecated: hide_deprecated || nil, page:, page_size:, sort:, sort_order:, version:)

  if json
    output_json(mods)
  else
    output_table(mods)
  end
end