From aec45eebd44d5b63cdcaec1eb79e9476a3210c01 Mon Sep 17 00:00:00 2001 From: Glenn Date: Mon, 15 Jan 2024 09:08:36 +0100 Subject: [PATCH] fix: replace vault by mapping As the software object has evolved along the way, and the handling of vaults has become generic FUSE filesystems mapping management, we need to correct all the places that still mention vaults. --- src/file_system_manager.cr | 2 +- src/models/concerns/base.cr | 2 +- src/parsers/config_parser.cr | 2 +- src/parsers/mapping_parser.cr | 20 ++++++++++++-------- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/file_system_manager.cr b/src/file_system_manager.cr index 91dc1a8..5c78da6 100644 --- a/src/file_system_manager.cr +++ b/src/file_system_manager.cr @@ -120,7 +120,7 @@ module GX puts ">> #{selected_filesystem.name}".colorize(:yellow) if !selected_filesystem - STDERR.puts "Vault not found: #{selected_filesystem}.".colorize(:red) + STDERR.puts "Mapping not found: #{selected_filesystem}.".colorize(:red) return end return selected_filesystem diff --git a/src/models/concerns/base.cr b/src/models/concerns/base.cr index 90254de..223e155 100644 --- a/src/models/concerns/base.cr +++ b/src/models/concerns/base.cr @@ -46,7 +46,7 @@ module GX::Models::Concerns if result_status.success? puts "Models #{name} is now available on #{mount_point_safe}".colorize(:green) else - puts "Error mounting the vault".colorize(:red) + puts "Error mounting the mapping".colorize(:red) return end end diff --git a/src/parsers/config_parser.cr b/src/parsers/config_parser.cr index b902cd5..f1dfa3f 100644 --- a/src/parsers/config_parser.cr +++ b/src/parsers/config_parser.cr @@ -23,7 +23,7 @@ module GX::Parsers parser.banner = Utils.usage_line(breadcrumbs + "init", "Create initial mfm configuration") parser.separator("\nInit options") - parser.on("-p", "--path", "Set vault encrypted path") do |path| + parser.on("-p", "--path", "Set mapping encrypted path") do |path| config.config_init_options.try do |opts| opts.path = path end diff --git a/src/parsers/mapping_parser.cr b/src/parsers/mapping_parser.cr index fc972a9..5249ade 100644 --- a/src/parsers/mapping_parser.cr +++ b/src/parsers/mapping_parser.cr @@ -23,33 +23,37 @@ module GX::Parsers parser.on("create", "Create mapping") do config.mode = Types::Mode::MappingCreate - - pp parser + # pp parser parser.banner = Utils.usage_line(breadcrumbs + "create", "Create mapping", true) parser.separator("\nCreate options") - parser.on("-n", "--name", "Set vault name") do |name| + parser.on("-t", "--type TYPE", "Set filesystem type") do |type| + add_args = add_args.merge({type: type}) + end + + parser.on("-n", "--name", "Set mapping name") do |name| add_args = add_args.merge({name: name}) end - parser.on("-p", "--path", "Set vault encrypted path") do |path| + + parser.on("-p", "--path", "Set mapping encrypted path") do |path| add_args = add_args.merge({path: path}) end parser.separator(Utils.help_line(breadcrumbs + "create")) end - parser.on("edit", "Edit configuration") do |flag| + parser.on("edit", "Edit configuration") do |_| config.mode = Types::Mode::MappingEdit parser.separator(Utils.help_line(breadcrumbs + "edit")) # abort("FIXME: Not implemented") end - parser.on("mount", "Mount mapping") do |flag| + parser.on("mount", "Mount mapping") do |_| config.mode = Types::Mode::MappingMount parser.separator(Utils.help_line(breadcrumbs + "mount")) # abort("FIXME: Not implemented") end - parser.on("umount", "Umount mapping") do |flag| + parser.on("umount", "Umount mapping") do |_| config.mode = Types::Mode::MappingUmount parser.separator(Utils.help_line(breadcrumbs + "umount")) # abort("FIXME: Not implemented") @@ -61,7 +65,7 @@ module GX::Parsers parser.banner = Utils.usage_line(breadcrumbs + "delete", "Delete mapping", true) parser.separator("\nDelete options") - parser.on("-n", "--name", "Set vault name") do |name| + parser.on("-n", "--name", "Set mapping name") do |name| delete_args = delete_args.merge({name: name}) end parser.separator(Utils.help_line(breadcrumbs + "delete"))