feat: add confirmation kind to select y/n
This commit is contained in:
parent
1018a83e10
commit
ba5c18dc2b
@ -19,11 +19,15 @@ end
|
||||
|
||||
local function create_file(file)
|
||||
if utils.file_exists(file) then
|
||||
vim.ui.select({ "y", "n" }, { prompt = file .. " already exists. Overwrite?" }, function(choice)
|
||||
if choice == "y" then
|
||||
create_and_notify(file)
|
||||
vim.ui.select(
|
||||
{ "y", "n" },
|
||||
{ kind = "confirmation", prompt = file .. " already exists. Overwrite?" },
|
||||
function(choice)
|
||||
if choice == "y" then
|
||||
create_and_notify(file)
|
||||
end
|
||||
end
|
||||
end)
|
||||
)
|
||||
else
|
||||
create_and_notify(file)
|
||||
end
|
||||
|
||||
@ -68,7 +68,7 @@ function M.fn(node)
|
||||
return
|
||||
end
|
||||
|
||||
vim.ui.select({ "y", "n" }, { prompt = "Remove " .. node.name .. " ?" }, function(choice)
|
||||
vim.ui.select({ "y", "n" }, { kind = "confirmation", prompt = "Remove " .. node.name .. " ?" }, function(choice)
|
||||
if choice == "y" then
|
||||
if node.nodes ~= nil and not node.link_to then
|
||||
local success = remove_dir(node.absolute_path)
|
||||
|
||||
@ -93,7 +93,7 @@ function M.fn(node)
|
||||
end
|
||||
|
||||
if M.config.trash.require_confirm then
|
||||
vim.ui.select({ "y", "n" }, { prompt = "Trash " .. node.name .. " ?" }, function(choice)
|
||||
vim.ui.select({ "y", "n" }, { kind = "confirmation", prompt = "Trash " .. node.name .. " ?" }, function(choice)
|
||||
if choice == "y" then
|
||||
do_trash()
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user