WIP: feat: add scaffold for operations (command design pattern) #31
4 changed files with 15 additions and 11 deletions
|
@ -120,7 +120,7 @@ module GX
|
||||||
puts ">> #{selected_filesystem.name}".colorize(:yellow)
|
puts ">> #{selected_filesystem.name}".colorize(:yellow)
|
||||||
|
|
||||||
if !selected_filesystem
|
if !selected_filesystem
|
||||||
STDERR.puts "Vault not found: #{selected_filesystem}.".colorize(:red)
|
STDERR.puts "Mapping not found: #{selected_filesystem}.".colorize(:red)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
return selected_filesystem
|
return selected_filesystem
|
||||||
|
|
|
@ -46,7 +46,7 @@ module GX::Models::Concerns
|
||||||
if result_status.success?
|
if result_status.success?
|
||||||
puts "Models #{name} is now available on #{mount_point_safe}".colorize(:green)
|
puts "Models #{name} is now available on #{mount_point_safe}".colorize(:green)
|
||||||
else
|
else
|
||||||
puts "Error mounting the vault".colorize(:red)
|
puts "Error mounting the mapping".colorize(:red)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -23,7 +23,7 @@ module GX::Parsers
|
||||||
parser.banner = Utils.usage_line(breadcrumbs + "init", "Create initial mfm configuration")
|
parser.banner = Utils.usage_line(breadcrumbs + "init", "Create initial mfm configuration")
|
||||||
parser.separator("\nInit options")
|
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|
|
config.config_init_options.try do |opts|
|
||||||
opts.path = path
|
opts.path = path
|
||||||
end
|
end
|
||||||
|
|
|
@ -23,33 +23,37 @@ module GX::Parsers
|
||||||
|
|
||||||
parser.on("create", "Create mapping") do
|
parser.on("create", "Create mapping") do
|
||||||
config.mode = Types::Mode::MappingCreate
|
config.mode = Types::Mode::MappingCreate
|
||||||
|
# pp parser
|
||||||
pp parser
|
|
||||||
parser.banner = Utils.usage_line(breadcrumbs + "create", "Create mapping", true)
|
parser.banner = Utils.usage_line(breadcrumbs + "create", "Create mapping", true)
|
||||||
parser.separator("\nCreate options")
|
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})
|
add_args = add_args.merge({name: name})
|
||||||
end
|
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})
|
add_args = add_args.merge({path: path})
|
||||||
end
|
end
|
||||||
parser.separator(Utils.help_line(breadcrumbs + "create"))
|
parser.separator(Utils.help_line(breadcrumbs + "create"))
|
||||||
end
|
end
|
||||||
|
|
||||||
parser.on("edit", "Edit configuration") do |flag|
|
parser.on("edit", "Edit configuration") do |_|
|
||||||
config.mode = Types::Mode::MappingEdit
|
config.mode = Types::Mode::MappingEdit
|
||||||
parser.separator(Utils.help_line(breadcrumbs + "edit"))
|
parser.separator(Utils.help_line(breadcrumbs + "edit"))
|
||||||
# abort("FIXME: Not implemented")
|
# abort("FIXME: Not implemented")
|
||||||
end
|
end
|
||||||
|
|
||||||
parser.on("mount", "Mount mapping") do |flag|
|
parser.on("mount", "Mount mapping") do |_|
|
||||||
config.mode = Types::Mode::MappingMount
|
config.mode = Types::Mode::MappingMount
|
||||||
parser.separator(Utils.help_line(breadcrumbs + "mount"))
|
parser.separator(Utils.help_line(breadcrumbs + "mount"))
|
||||||
# abort("FIXME: Not implemented")
|
# abort("FIXME: Not implemented")
|
||||||
end
|
end
|
||||||
|
|
||||||
parser.on("umount", "Umount mapping") do |flag|
|
parser.on("umount", "Umount mapping") do |_|
|
||||||
config.mode = Types::Mode::MappingUmount
|
config.mode = Types::Mode::MappingUmount
|
||||||
parser.separator(Utils.help_line(breadcrumbs + "umount"))
|
parser.separator(Utils.help_line(breadcrumbs + "umount"))
|
||||||
# abort("FIXME: Not implemented")
|
# abort("FIXME: Not implemented")
|
||||||
|
@ -61,7 +65,7 @@ module GX::Parsers
|
||||||
parser.banner = Utils.usage_line(breadcrumbs + "delete", "Delete mapping", true)
|
parser.banner = Utils.usage_line(breadcrumbs + "delete", "Delete mapping", true)
|
||||||
parser.separator("\nDelete options")
|
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})
|
delete_args = delete_args.merge({name: name})
|
||||||
end
|
end
|
||||||
parser.separator(Utils.help_line(breadcrumbs + "delete"))
|
parser.separator(Utils.help_line(breadcrumbs + "delete"))
|
||||||
|
|
Loading…
Reference in a new issue