Class: Factorix::CLI::Commands::Path
- Inherits:
-
Base
- Object
- Dry::CLI::Command
- Base
- Factorix::CLI::Commands::Path
- Defined in:
- lib/factorix/cli/commands/path.rb,
sig/factorix/cli/commands/path.rbs
Overview
Display Factorio and Factorix paths
This command outputs all paths managed by the runtime environment.
Constant Summary collapse
- PATH_TYPES =
Mapping from path type keys to runtime method names
{ "executable_path" => :executable_path, "data_dir" => :data_dir, "user_dir" => :user_dir, "mod_dir" => :mod_dir, "save_dir" => :save_dir, "script_output_dir" => :script_output_dir, "mod_list_path" => :mod_list_path, "mod_settings_path" => :mod_settings_path, "player_data_path" => :player_data_path, "lock_path" => :lock_path, "current_log_path" => :current_log_path, "previous_log_path" => :previous_log_path, "factorix_cache_dir" => :factorix_cache_dir, "factorix_config_path" => :factorix_config_path, "factorix_log_path" => :factorix_log_path }.freeze
Instance Attribute Summary collapse
-
#logger ⇒ Dry::Logger::Dispatcher
readonly
Returns the value of attribute logger.
-
#runtime ⇒ Runtime::Base
readonly
Returns the value of attribute runtime.
Instance Method Summary collapse
-
#call(json:) ⇒ void
Execute the path command.
Methods inherited from Base
backup_support!, confirmable!, inherited, require_game_stopped!
Instance Attribute Details
#logger ⇒ Dry::Logger::Dispatcher (readonly)
Returns the value of attribute logger.
12 13 14 |
# File 'sig/factorix/cli/commands/path.rbs', line 12 def logger @logger end |
#runtime ⇒ Runtime::Base (readonly)
Returns the value of attribute runtime.
11 12 13 |
# File 'sig/factorix/cli/commands/path.rbs', line 11 def runtime @runtime end |
Instance Method Details
#call(json:) ⇒ void
This method returns an undefined value.
Execute the path command
58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/factorix/cli/commands/path.rb', line 58 def call(json:, **) logger.debug("Displaying all paths") result = PATH_TYPES.transform_values {|method_name| runtime.public_send(method_name).to_s } if json out.puts JSON.pretty_generate(result) else output_table(result) end end |