Edit last record in EDITOR (option -w
) if id=-1.
This is a convenience feature. If the user is using a keyboard shortcut to add a selected link as bookmark from the DE, he may want to edit it shortly. The -1 index enables him to open the last bookmark added without using option `-p -1`.
This commit is contained in:
parent
df5bdc1921
commit
f72f8af3d8
@ -160,7 +160,8 @@ GENERAL OPTIONS:
|
||||
- otherwise refresh all titles
|
||||
-w, --write [editor|index]
|
||||
open editor to edit a fresh bookmark
|
||||
to update by index, EDITOR must be set
|
||||
edit last bookmark, if index=-1
|
||||
to specify index, EDITOR must be set
|
||||
-d, --delete [...] remove bookmarks from DB
|
||||
accepts indices or a single range
|
||||
if no arguments:
|
||||
|
2
buku.1
2
buku.1
@ -105,7 +105,7 @@ Edit a bookmark in
|
||||
.I editor
|
||||
before adding it. To edit and update an existing bookmark, the
|
||||
.I index
|
||||
should be passed. However, in this case the environment variable EDITOR must be set.
|
||||
should be passed. However, in this case the environment variable EDITOR must be set. The last record is opened in EDITOR if index=-1.
|
||||
.TP
|
||||
.BI \-d " " \--delete " [...]"
|
||||
Delete bookmarks. Accepts space-separated list of indices (e.g. 5 6 23 4 110 45) or a single hyphenated range (e.g. 100-200). Note that range and list don't work together. Deletes search results when combined with search options, if no arguments.
|
||||
|
11
buku.py
11
buku.py
@ -1160,6 +1160,7 @@ class BukuDb:
|
||||
----------
|
||||
index : int
|
||||
DB index of the record.
|
||||
Last record, if index is -1.
|
||||
immutable : int, optional
|
||||
Diable title fetch from web if 1. Default is -1.
|
||||
|
||||
@ -1174,6 +1175,13 @@ class BukuDb:
|
||||
logerr('EDITOR must be set to use index with -w')
|
||||
return False
|
||||
|
||||
if (index == -1):
|
||||
# Edit the last records
|
||||
index = self.get_max_id()
|
||||
if index == -1:
|
||||
logerr('Empty database')
|
||||
return False
|
||||
|
||||
rec = self.get_rec_by_id(index)
|
||||
if not rec:
|
||||
logerr('No matching index %d', index)
|
||||
@ -3846,7 +3854,8 @@ POSITIONAL ARGUMENTS:
|
||||
- otherwise refresh all titles
|
||||
-w, --write [editor|index]
|
||||
open editor to edit a fresh bookmark
|
||||
to update by index, EDITOR must be set
|
||||
edit last bookmark, if index=-1
|
||||
to specify index, EDITOR must be set
|
||||
-d, --delete [...] remove bookmarks from DB
|
||||
accepts indices or a single range
|
||||
if no arguments:
|
||||
|
Loading…
Reference in New Issue
Block a user