Option --suggest - list similar bookmarks
This commit is contained in:
parent
8a1177c176
commit
5b26d49044
@ -223,6 +223,7 @@ POWER TOYS:
|
||||
delete old tag, if new tag not specified
|
||||
--shorten index|URL fetch shortened url from tny.im service
|
||||
--expand index|URL expand a tny.im shortened url
|
||||
--suggest show similar tags when adding bookmarks
|
||||
--tacit reduce verbosity
|
||||
--threads N max network connections in full refresh
|
||||
default N=4, min N=1, max N=10
|
||||
|
@ -35,6 +35,7 @@ _buku () {
|
||||
-s --sany
|
||||
-S --sall
|
||||
--shorten
|
||||
--suggest
|
||||
-t --stag
|
||||
--tacit
|
||||
--tag
|
||||
|
@ -28,6 +28,7 @@ complete -c buku -l replace -r --description 'replace a tag'
|
||||
complete -c buku -s s -l sany -r --description 'match any keyword'
|
||||
complete -c buku -s S -l sall -r --description 'match all keywords'
|
||||
complete -c buku -l shorten -r --description 'shorten a URL using tny.im'
|
||||
complete -c buku -l suggest --description 'show a list of similar tags'
|
||||
complete -c buku -s t -l stag --description 'search by tag or show tags'
|
||||
complete -c buku -l tacit --description 'reduce verbosity'
|
||||
complete -c buku -l tag --description 'set tags, use + to append, - to remove'
|
||||
|
@ -33,6 +33,7 @@ args=(
|
||||
'(-s --sany)'{-s,--sany}'[match any keyword]:keyword(s)'
|
||||
'(-s --sall)'{-s,--sall}'[match all keywords]:keyword(s)'
|
||||
'(--shorten)--shorten[shorten a URL using tny.im]:index/url'
|
||||
'(--suggest)--suggest[show a list of similar tags]'
|
||||
'(-t --stag)'{-t,--stag}'[search by tag or show tags]'
|
||||
'(--tacit)--tacit[reduce verbosity]'
|
||||
'(--tag)--tag[set tags, use + to append, - to remove]'
|
||||
|
3
buku.1
3
buku.1
@ -240,6 +240,9 @@ or an independent
|
||||
.I URL
|
||||
shortened using tny.im.
|
||||
.TP
|
||||
.BI \--suggest
|
||||
Show a list of similar tags to choose from when adding a new bookmark.
|
||||
.TP
|
||||
.BI \--tacit
|
||||
Show lesser output. Reduces the verbosity of certain operations like add, update etc.
|
||||
.TP
|
||||
|
8
buku.py
8
buku.py
@ -1394,7 +1394,7 @@ class BukuDb:
|
||||
|
||||
return unique_tags, dic
|
||||
|
||||
def get_tag_similar(self, tagstr):
|
||||
def suggest_similar_tag(self, tagstr):
|
||||
'''Show list of tags those go together in DB
|
||||
|
||||
:param tagstr: original tag string
|
||||
@ -3037,6 +3037,7 @@ POSITIONAL ARGUMENTS:
|
||||
delete old tag, if new tag not specified
|
||||
--shorten index|URL fetch shortened url from tny.im service
|
||||
--expand index|URL expand a tny.im shortened url
|
||||
--suggest show similar tags when adding bookmarks
|
||||
--tacit reduce verbosity
|
||||
--threads N max network connections in full refresh
|
||||
default N=4, min N=1, max N=10
|
||||
@ -3057,6 +3058,7 @@ POSITIONAL ARGUMENTS:
|
||||
addarg('--replace', nargs='+', help=HIDE)
|
||||
addarg('--shorten', nargs=1, help=HIDE)
|
||||
addarg('--expand', nargs=1, help=HIDE)
|
||||
addarg('--suggest', action='store_true', help=HIDE)
|
||||
addarg('--tacit', action='store_true', help=HIDE)
|
||||
addarg('--threads', type=int, default=4, choices=range(1, 11), help=HIDE)
|
||||
addarg('-V', dest='upstream', action='store_true', help=HIDE)
|
||||
@ -3156,6 +3158,8 @@ POSITIONAL ARGUMENTS:
|
||||
result = edit_rec(args.write, '', title_in, tags, desc_in)
|
||||
if result is not None:
|
||||
url, title_in, tags, desc_in = result
|
||||
if args.suggest:
|
||||
tags = bdb.suggest_similar_tag(tags)
|
||||
bdb.add_rec(url, title_in, tags, desc_in, args.immutable)
|
||||
|
||||
# Add record
|
||||
@ -3188,6 +3192,8 @@ POSITIONAL ARGUMENTS:
|
||||
if result is not None:
|
||||
url, title_in, tags, desc_in = result
|
||||
|
||||
if args.suggest:
|
||||
tags = bdb.suggest_similar_tag(tags)
|
||||
bdb.add_rec(url, title_in, tags, desc_in, args.immutable)
|
||||
|
||||
# Search record
|
||||
|
Loading…
x
Reference in New Issue
Block a user