Add --delete option to bookmark-load
This commit is contained in:
parent
1ac45d8971
commit
b2c2d5a4f4
@ -1162,7 +1162,8 @@ class CommandDispatcher:
|
|||||||
@cmdutils.register(instance='command-dispatcher', scope='window',
|
@cmdutils.register(instance='command-dispatcher', scope='window',
|
||||||
maxsplit=0)
|
maxsplit=0)
|
||||||
@cmdutils.argument('url', completion=usertypes.Completion.bookmark_by_url)
|
@cmdutils.argument('url', completion=usertypes.Completion.bookmark_by_url)
|
||||||
def bookmark_load(self, url, tab=False, bg=False, window=False):
|
def bookmark_load(self, url, tab=False, bg=False, window=False,
|
||||||
|
delete=False):
|
||||||
"""Load a bookmark.
|
"""Load a bookmark.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -1170,12 +1171,15 @@ class CommandDispatcher:
|
|||||||
tab: Load the bookmark in a new tab.
|
tab: Load the bookmark in a new tab.
|
||||||
bg: Load the bookmark in a new background tab.
|
bg: Load the bookmark in a new background tab.
|
||||||
window: Load the bookmark in a new window.
|
window: Load the bookmark in a new window.
|
||||||
|
delete: Whether to delete the bookmark afterwards.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
url = urlutils.fuzzy_url(url)
|
qurl = urlutils.fuzzy_url(url)
|
||||||
except urlutils.InvalidUrlError as e:
|
except urlutils.InvalidUrlError as e:
|
||||||
raise cmdexc.CommandError(e)
|
raise cmdexc.CommandError(e)
|
||||||
self._open(url, tab, bg, window)
|
self._open(qurl, tab, bg, window)
|
||||||
|
if delete:
|
||||||
|
self.bookmark_del(url)
|
||||||
|
|
||||||
@cmdutils.register(instance='command-dispatcher', scope='window',
|
@cmdutils.register(instance='command-dispatcher', scope='window',
|
||||||
maxsplit=0)
|
maxsplit=0)
|
||||||
|
@ -103,6 +103,11 @@ Feature: quickmarks and bookmarks
|
|||||||
And I run :bookmark-add --toggle
|
And I run :bookmark-add --toggle
|
||||||
Then the bookmark file should not contain "http://localhost:*/data/numbers/7.txt "
|
Then the bookmark file should not contain "http://localhost:*/data/numbers/7.txt "
|
||||||
|
|
||||||
|
Scenario: Loading a bookmark with --delete
|
||||||
|
When I run :bookmark-add http://localhost:(port)/data/numbers/8.txt "eight"
|
||||||
|
And I run :bookmark-load -d http://localhost:(port)/data/numbers/8.txt
|
||||||
|
Then the bookmark file should not contain "http://localhost:*/data/numbers/8.txt "
|
||||||
|
|
||||||
## quickmarks
|
## quickmarks
|
||||||
|
|
||||||
Scenario: Saving a quickmark (:quickmark-add)
|
Scenario: Saving a quickmark (:quickmark-add)
|
||||||
|
Loading…
Reference in New Issue
Block a user