Class: Factorix::CLI::Commands::MOD::Settings::Dump
- Defined in:
- lib/factorix/cli/commands/mod/settings/dump.rb
Overview
Dump MOD settings to JSON format
Instance Method Summary collapse
-
#call(settings_file: nil, output: nil) ⇒ void
Execute the dump command.
Methods inherited from Base
backup_support!, confirmable!, inherited, require_game_stopped!
Instance Method Details
#call(settings_file: nil, output: nil) ⇒ void
This method returns an undefined value.
Execute the dump command
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/factorix/cli/commands/mod/settings/dump.rb', line 33 def call(settings_file: nil, output: nil, **) # Load MOD settings settings_path = settings_file ? Pathname(settings_file) : runtime.mod_settings_path settings = MODSettings.load(settings_path) # Convert to JSON format data = build_hash(settings) output_string = JSON.pretty_generate(data) # Write to output if output Pathname(output).write(output_string) else out.puts output_string end end |