1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-06 15:14:12 +01:00

Add a ! bang version of :delbmarks to delete all bookmarks.

This commit is contained in:
Doug Kearns
2009-08-09 01:50:59 +10:00
parent e36f9780a7
commit 415db95601
4 changed files with 25 additions and 9 deletions

View File

@@ -387,13 +387,30 @@ function Bookmarks() //{{{
"Delete a bookmark",
function (args)
{
let url = args.string || buffer.URL;
let deletedCount = bookmarks.remove(url);
if (args.bang)
{
commandline.input("This will delete all bookmarks. Would you like to continue? (yes/[no]) ",
function (resp)
{
if (resp && resp.match(/^y(es)?$/i))
{
bookmarks.get("").forEach(function (bmark) { bookmarks.remove(bmark.url); });
liberator.echomsg("All bookmarks deleted", 1, commandline.FORCE_SINGLELINE);
}
});
}
else
{
let url = args.string || buffer.URL;
let deletedCount = bookmarks.remove(url);
liberator.echomsg(deletedCount + " bookmark(s) with url `" + url + "' deleted", 1, commandline.FORCE_SINGLELINE);
}
liberator.echomsg(deletedCount + " bookmark(s) with url `" + url + "' deleted", 1, commandline.FORCE_SINGLELINE);
},
{
argCount: "?",
bang: true,
completer: function completer(context) completion.bookmark(context),
literal: 0
});