mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-03 16:05:46 +01:00
Add -keywords, -tags, -title to :delbmarks.
This commit is contained in:
@@ -96,10 +96,14 @@ const Bookmarks = Module("bookmarks", {
|
||||
// returns number of deleted bookmarks
|
||||
remove: function remove(url) {
|
||||
try {
|
||||
let uri = util.newURI(url);
|
||||
let bmarks = services.get("bookmarks")
|
||||
.getBookmarkIdsForURI(uri, {})
|
||||
.filter(bookmarkcache.closure.isRegularBookmark);
|
||||
if (isArray(url))
|
||||
var bmarks = url;
|
||||
else {
|
||||
let uri = util.newURI(url);
|
||||
var bmarks = services.get("bookmarks")
|
||||
.getBookmarkIdsForURI(uri, {})
|
||||
.filter(bookmarkcache.closure.isRegularBookmark);
|
||||
}
|
||||
bmarks.forEach(services.get("bookmarks").removeItem);
|
||||
return bmarks.length;
|
||||
}
|
||||
@@ -382,10 +386,16 @@ const Bookmarks = Module("bookmarks", {
|
||||
}
|
||||
});
|
||||
else {
|
||||
let url = args[0] || buffer.URL;
|
||||
let deletedCount = bookmarks.remove(url);
|
||||
if (!(args.length || args["-tags"] || args["-keyword"] || args["-title"]))
|
||||
var deletedCount = bookmarks.remove(buffer.URL);
|
||||
else {
|
||||
let context = CompletionContext(args.join(" "));
|
||||
context.fork("bookmark", 0, completion, "bookmark",
|
||||
args["-tags"], { keyword: args["-keyword"], title: args["-title"] });
|
||||
var deletedCount = bookmarks.remove(context.allItems.items.map(function (item) item.item.id));
|
||||
}
|
||||
|
||||
dactyl.echomsg({ domains: [util.getHost(url)], message: deletedCount + " bookmark(s) with url " + url.quote() + " deleted" },
|
||||
dactyl.echomsg({ message: deletedCount + " bookmark(s) deleted" },
|
||||
1, commandline.FORCE_SINGLELINE);
|
||||
}
|
||||
|
||||
@@ -393,8 +403,12 @@ const Bookmarks = Module("bookmarks", {
|
||||
{
|
||||
argCount: "?",
|
||||
bang: true,
|
||||
completer: function completer(context) completion.bookmark(context),
|
||||
literal: 0
|
||||
completer: function completer(context)
|
||||
completion.bookmark(context, args["-tags"], { keyword: args["-keyword"], title: args["-title"] }),
|
||||
domains: function (args) array.compact(args.map(util.getHost)),
|
||||
literal: 0,
|
||||
options: [tags, title, keyword],
|
||||
privateData: true
|
||||
});
|
||||
},
|
||||
mappings: function () {
|
||||
@@ -457,11 +471,10 @@ const Bookmarks = Module("bookmarks", {
|
||||
completion.bookmark = function bookmark(context, tags, extra) {
|
||||
context.title = ["Bookmark", "Title"];
|
||||
context.format = bookmarks.format;
|
||||
for (let val in Iterator(extra || [])) {
|
||||
let [k, v] = val; // Need block scope here for the closure
|
||||
forEach(iter(extra || {}), function ([k, v]) {
|
||||
if (v)
|
||||
context.filters.push(function (item) this.matchString(v, item[k]));
|
||||
}
|
||||
});
|
||||
context.completions = bookmarkcache.bookmarks;
|
||||
completion.urls(context, tags);
|
||||
};
|
||||
|
||||
@@ -120,11 +120,19 @@
|
||||
<p>The bookmarks may also be filtered via the following options,</p>
|
||||
|
||||
<dl>
|
||||
<dt>-tag</dt>
|
||||
<dt>-keyword</dt>
|
||||
<dd>
|
||||
The bookmark's keyword (short name <em>-k</em>).
|
||||
</dd>
|
||||
<dt>-tags</dt>
|
||||
<dd>
|
||||
A comma-separated list of tags, all of which must be
|
||||
present for a match (short name <em>-T</em>).
|
||||
</dd>
|
||||
<dt>-title</dt>
|
||||
<dd>
|
||||
The title of the bookmark (short name <em>-t</em>).
|
||||
</dd>
|
||||
<dt>-max</dt>
|
||||
<dd>
|
||||
The maximum number of items to list or open
|
||||
@@ -145,6 +153,8 @@
|
||||
current buffer.
|
||||
</p>
|
||||
|
||||
<p>Accepts the same options as :bmarks.</p>
|
||||
|
||||
<p>If <oa>!</oa> is specified then all bookmarks will be deleted.</p>
|
||||
</description>
|
||||
</item>
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
* Added 'autocomplete' option for specifying which completion
|
||||
groups should be auto-completed.
|
||||
* Added 'banghist' option.
|
||||
* Added -keyword, -tags, -title to :delbmarks
|
||||
* Added 'hintkeys' option.
|
||||
* Replaced 'focuscontent' with 'strictfocus'.
|
||||
* Added 'wildanchor' option.
|
||||
|
||||
@@ -34,7 +34,6 @@ BUGS:
|
||||
|
||||
FEATURES:
|
||||
9 Add quoting help tag
|
||||
9 Support multiple bookmarks, -keyword, -tags in :delbmarks
|
||||
8 Document Caret and Visual modes.
|
||||
8 finish :help TODOs
|
||||
8 fix local options
|
||||
|
||||
Reference in New Issue
Block a user