2024-01-14 19:31:38 +00:00
|
|
|
require "./abstract_command"
|
|
|
|
require "../file_system_manager"
|
|
|
|
|
|
|
|
module GX::Commands
|
|
|
|
class MappingMount < AbstractCommand
|
|
|
|
@file_system_manager : FileSystemManager
|
|
|
|
|
2024-01-23 23:06:52 +00:00
|
|
|
def initialize(@config : GX::Config)
|
2024-01-14 19:31:38 +00:00
|
|
|
@config.load_from_env
|
|
|
|
@config.load_from_file
|
|
|
|
@file_system_manager = FileSystemManager.new(@config)
|
|
|
|
end
|
|
|
|
|
|
|
|
def execute
|
|
|
|
filesystem = @file_system_manager.choose_filesystem
|
|
|
|
raise Models::InvalidFilesystemError.new("Invalid filesystem") if filesystem.nil?
|
|
|
|
# @file_system_manager.mount_or_umount(filesystem)
|
|
|
|
filesystem.mount
|
|
|
|
@file_system_manager.auto_open(filesystem) if filesystem.mounted? && @config.auto_open
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.handles_mode
|
|
|
|
GX::Types::Mode::MappingMount
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|