WIP: feature/1-add-support-for-fs-crud #47
2 changed files with 12 additions and 0 deletions
|
@ -4,12 +4,14 @@
|
|||
# Copyright © 2024 Glenn Y. Rolland <glenux@glenux.net>
|
||||
|
||||
require "./abstract_command"
|
||||
require "../models/filesystem_factory"
|
||||
|
||||
module GX::Commands
|
||||
class MappingCreate < AbstractCommand
|
||||
def initialize(@config : GX::Config)
|
||||
@config.load_from_env
|
||||
@config.load_from_file
|
||||
@config.save_to_file
|
||||
end
|
||||
|
||||
def execute
|
||||
|
|
|
@ -120,5 +120,15 @@ module GX
|
|||
end
|
||||
@root = root
|
||||
end
|
||||
|
||||
def save_to_file
|
||||
return if @path.nil?
|
||||
if @path
|
||||
File.write(@path.to_s, @root.to_yaml)
|
||||
else
|
||||
Log.error { "Configuration path is nil, cannot save configuration." }
|
||||
end
|
||||
Log.info { "Configuration saved to #{@path}" }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue