refactor: Remove direct initialization of file_system_manager in commands

This commit is contained in:
Glenn Y. Rolland 2024-12-11 00:08:11 +01:00
parent 01804f1139
commit 06e3d1895c
4 changed files with 2 additions and 6 deletions

View file

@ -17,7 +17,6 @@ module GX::Commands
end end
def execute def execute
filesystem = @file_system_manager.choose_filesystem
raise Models::InvalidFilesystemError.new("Invalid filesystem") if filesystem.nil? raise Models::InvalidFilesystemError.new("Invalid filesystem") if filesystem.nil?
@file_system_manager.mount_or_umount(filesystem) @file_system_manager.mount_or_umount(filesystem)
@file_system_manager.auto_open(filesystem) if filesystem.mounted? && @config.auto_open? @file_system_manager.auto_open(filesystem) if filesystem.mounted? && @config.auto_open?

View file

@ -12,7 +12,6 @@ module GX::Commands
def initialize(@config : GX::Config) def initialize(@config : GX::Config)
@config.load_from_env @config.load_from_env
@config.load_from_file @config.load_from_file
@file_system_manager = FileSystemManager.new(@config)
end end
def execute def execute

View file

@ -13,11 +13,10 @@ module GX::Commands
def initialize(@config : GX::Config) def initialize(@config : GX::Config)
@config.load_from_env @config.load_from_env
@config.load_from_file @config.load_from_file
@file_system_manager = FileSystemManager.new(@config)
end end
def execute def execute
filesystem = @file_system_manager.choose_filesystem filesystem = @config.root.try &.file_system_manager.choose_filesystem
raise Models::InvalidFilesystemError.new("Invalid filesystem") if filesystem.nil? raise Models::InvalidFilesystemError.new("Invalid filesystem") if filesystem.nil?
filesystem.mount filesystem.mount
@file_system_manager.auto_open(filesystem) if filesystem.mounted? && @config.auto_open? @file_system_manager.auto_open(filesystem) if filesystem.mounted? && @config.auto_open?

View file

@ -13,11 +13,10 @@ module GX::Commands
def initialize(@config : GX::Config) def initialize(@config : GX::Config)
@config.load_from_env @config.load_from_env
@config.load_from_file @config.load_from_file
@file_system_manager = FileSystemManager.new(@config)
end end
def execute def execute
filesystem = @file_system_manager.choose_filesystem filesystem = @config.root.try &.file_system_manager.choose_filesystem
raise Models::InvalidFilesystemError.new("Invalid filesystem") if filesystem.nil? raise Models::InvalidFilesystemError.new("Invalid filesystem") if filesystem.nil?
filesystem.umount filesystem.umount
end end