Support print records at prompt
This commit is contained in:
parent
706f234989
commit
b9fbed2cab
3
buku.1
3
buku.1
@ -269,6 +269,9 @@ Search bookmarks by a tag. List all tags alphabetically, if no arguments. The in
|
|||||||
.BI "g" " [...][>>|>|<<][...]"
|
.BI "g" " [...][>>|>|<<][...]"
|
||||||
Append, remove tags to/from indices and/or ranges.
|
Append, remove tags to/from indices and/or ranges.
|
||||||
.TP
|
.TP
|
||||||
|
.BI "p" " [...]"
|
||||||
|
Print bookmarks by indices and/or ranges.
|
||||||
|
.TP
|
||||||
.BI "w" " [editor|index]"
|
.BI "w" " [editor|index]"
|
||||||
Edit and add or update a bookmark.
|
Edit and add or update a bookmark.
|
||||||
.TP
|
.TP
|
||||||
|
25
buku.py
25
buku.py
@ -1793,6 +1793,7 @@ keys:
|
|||||||
r expression run a regex search
|
r expression run a regex search
|
||||||
t [...] search bookmarks by a tag or show tag list
|
t [...] search bookmarks by a tag or show tag list
|
||||||
g [...][>>|>|<<][...] append, remove tags to/from indices and/or ranges
|
g [...][>>|>|<<][...] append, remove tags to/from indices and/or ranges
|
||||||
|
p [...] print bookmarks by indices and/or ranges
|
||||||
w [editor|index] edit and add or update a bookmark
|
w [editor|index] edit and add or update a bookmark
|
||||||
(tag list index fetches bookmarks by tag)
|
(tag list index fetches bookmarks by tag)
|
||||||
? show this help
|
? show this help
|
||||||
@ -2104,7 +2105,7 @@ def taglist_subprompt(obj, msg, noninteractive=False):
|
|||||||
elif (nav == 'q' or nav == 'd' or nav == '?' or
|
elif (nav == 'q' or nav == 'd' or nav == '?' or
|
||||||
nav.startswith('s ') or nav.startswith('S ') or
|
nav.startswith('s ') or nav.startswith('S ') or
|
||||||
nav.startswith('r ') or nav.startswith('t ') or
|
nav.startswith('r ') or nav.startswith('t ') or
|
||||||
nav.startswith('g ')):
|
nav.startswith('g ') or nav.startswith('p ')):
|
||||||
return nav
|
return nav
|
||||||
elif nav == 'w' or nav.startswith('w '):
|
elif nav == 'w' or nav.startswith('w '):
|
||||||
edit_at_prompt(obj, nav)
|
edit_at_prompt(obj, nav)
|
||||||
@ -2220,7 +2221,7 @@ def prompt(obj, results, noninteractive=False, deep=False, subprompt=False):
|
|||||||
edit_at_prompt(obj, nav)
|
edit_at_prompt(obj, nav)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# append or overwrite tags
|
# Append or overwrite tags
|
||||||
if nav.startswith('g '):
|
if nav.startswith('g '):
|
||||||
unique_tags, dic = obj.get_tag_all()
|
unique_tags, dic = obj.get_tag_all()
|
||||||
_count = obj.set_tag(nav[2:], unique_tags)
|
_count = obj.set_tag(nav[2:], unique_tags)
|
||||||
@ -2230,6 +2231,26 @@ def prompt(obj, results, noninteractive=False, deep=False, subprompt=False):
|
|||||||
print('%d updated' % _count)
|
print('%d updated' % _count)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
# Print bookmarks by DB index
|
||||||
|
if nav.startswith('p '):
|
||||||
|
id_list = nav[2:].split()
|
||||||
|
try:
|
||||||
|
for id in id_list:
|
||||||
|
if is_int(id) and int(id) > 0:
|
||||||
|
obj.print_rec(int(id))
|
||||||
|
elif '-' in id:
|
||||||
|
vals = [int(x) for x in id.split('-')]
|
||||||
|
if vals[0] > vals[-1]:
|
||||||
|
vals[0], vals[-1] = vals[-1], vals[0]
|
||||||
|
|
||||||
|
for _id in range(vals[0], vals[-1] + 1):
|
||||||
|
obj.print_rec(_id)
|
||||||
|
else:
|
||||||
|
print('Invalid input')
|
||||||
|
except ValueError:
|
||||||
|
print('Invalid input')
|
||||||
|
continue
|
||||||
|
|
||||||
# Nothing to browse if there are no results
|
# Nothing to browse if there are no results
|
||||||
if not results:
|
if not results:
|
||||||
print('Not in a search context')
|
print('Not in a search context')
|
||||||
|
@ -47,6 +47,7 @@ keys:
|
|||||||
r expression run a regex search
|
r expression run a regex search
|
||||||
t [...] search bookmarks by a tag or show tag list
|
t [...] search bookmarks by a tag or show tag list
|
||||||
g [...][>>|>|<<][...] append, remove tags to/from indices and/or ranges
|
g [...][>>|>|<<][...] append, remove tags to/from indices and/or ranges
|
||||||
|
p [...] print bookmarks by indices and/or ranges
|
||||||
w [editor|index] edit and add or update a bookmark
|
w [editor|index] edit and add or update a bookmark
|
||||||
(tag list index fetches bookmarks by tag)
|
(tag list index fetches bookmarks by tag)
|
||||||
? show this help
|
? show this help
|
||||||
|
Loading…
Reference in New Issue
Block a user