mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 02:38:46 +00:00
feat(picker.git): add confirmation before deleting a git branch (#951)
## Description A minor update to add a confirmation dialogue before deleting a branch in `git_branches`. ## Related Issue(s) <!-- If this PR fixes any issues, please link to the issue here. - Fixes #<issue_number> --> ## Screenshots <!-- Add screenshots of the changes if applicable. --> --------- Co-authored-by: Ian Liu <ian.liu@tupl.com>
This commit is contained in:
parent
398c2cb7ff
commit
337a3ae7ee
1 changed files with 12 additions and 8 deletions
|
@ -350,14 +350,18 @@ function M.git_branch_del(picker, item)
|
|||
return
|
||||
end
|
||||
|
||||
-- Proceed with deletion
|
||||
Snacks.picker.util.cmd({ "git", "branch", "-d", branch }, function()
|
||||
Snacks.notify("Deleted Branch `" .. branch .. "`", { title = "Snacks Picker" })
|
||||
vim.cmd.checktime()
|
||||
picker.list:set_selected()
|
||||
picker.list:set_target()
|
||||
picker:find()
|
||||
end, { cwd = picker:cwd() })
|
||||
Snacks.picker.select({ "Yes", "No" }, { prompt = ("Delete branch %q?"):format(branch) }, function(_, idx)
|
||||
if idx == 1 then
|
||||
-- Proceed with deletion
|
||||
Snacks.picker.util.cmd({ "git", "branch", "-d", branch }, function()
|
||||
Snacks.notify("Deleted Branch `" .. branch .. "`", { title = "Snacks Picker" })
|
||||
vim.cmd.checktime()
|
||||
picker.list:set_selected()
|
||||
picker.list:set_target()
|
||||
picker:find()
|
||||
end, { cwd = picker:cwd() })
|
||||
end
|
||||
end)
|
||||
end, { cwd = picker:cwd() })
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue