From 06e3d1895cc8e5974b16a96edc25eb448e1d873d Mon Sep 17 00:00:00 2001 From: "Glenn Y. Rolland" Date: Wed, 11 Dec 2024 00:08:11 +0100 Subject: [PATCH] refactor: Remove direct initialization of file_system_manager in commands --- src/commands/global_tui.cr | 1 - src/commands/mapping_list.cr | 1 - src/commands/mapping_mount.cr | 3 +-- src/commands/mapping_umount.cr | 3 +-- 4 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/commands/global_tui.cr b/src/commands/global_tui.cr index 0b71acd..605d318 100644 --- a/src/commands/global_tui.cr +++ b/src/commands/global_tui.cr @@ -17,7 +17,6 @@ module GX::Commands 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) @file_system_manager.auto_open(filesystem) if filesystem.mounted? && @config.auto_open? diff --git a/src/commands/mapping_list.cr b/src/commands/mapping_list.cr index 3754edd..a3a6286 100644 --- a/src/commands/mapping_list.cr +++ b/src/commands/mapping_list.cr @@ -12,7 +12,6 @@ module GX::Commands def initialize(@config : GX::Config) @config.load_from_env @config.load_from_file - @file_system_manager = FileSystemManager.new(@config) end def execute diff --git a/src/commands/mapping_mount.cr b/src/commands/mapping_mount.cr index 7f2a1af..51cf2b7 100644 --- a/src/commands/mapping_mount.cr +++ b/src/commands/mapping_mount.cr @@ -13,11 +13,10 @@ module GX::Commands def initialize(@config : GX::Config) @config.load_from_env @config.load_from_file - @file_system_manager = FileSystemManager.new(@config) end 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? filesystem.mount @file_system_manager.auto_open(filesystem) if filesystem.mounted? && @config.auto_open? diff --git a/src/commands/mapping_umount.cr b/src/commands/mapping_umount.cr index 77364c2..5e4b929 100644 --- a/src/commands/mapping_umount.cr +++ b/src/commands/mapping_umount.cr @@ -13,11 +13,10 @@ module GX::Commands def initialize(@config : GX::Config) @config.load_from_env @config.load_from_file - @file_system_manager = FileSystemManager.new(@config) end 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? filesystem.umount end