Show tags moved from -S to --st.
This commit is contained in:
parent
348e12534d
commit
7f0dbd972c
13
README.md
13
README.md
@ -107,7 +107,7 @@ Shell completion scripts for Bash, Fish and Zsh can be found in respective subdi
|
|||||||
|
|
||||||
usage: buku [-a URL [tags ...]] [-u [N [URL tags ...]]]
|
usage: buku [-a URL [tags ...]] [-u [N [URL tags ...]]]
|
||||||
[-t [...]] [-c [...]] [-d [N]] [-h]
|
[-t [...]] [-c [...]] [-d [N]] [-h]
|
||||||
[-s keyword [...]] [-S keyword [...]] [--st keyword [...]]
|
[-s keyword [...]] [-S keyword [...]] [--st [...]]
|
||||||
[-k [N]] [-l [N]] [-p [N]] [-f N]
|
[-k [N]] [-l [N]] [-p [N]] [-f N]
|
||||||
[-r oldtag [newtag ...]] [-j] [-o N] [-z]
|
[-r oldtag [newtag ...]] [-j] [-o N] [-z]
|
||||||
|
|
||||||
@ -134,11 +134,10 @@ Shell completion scripts for Bash, Fish and Zsh can be found in respective subdi
|
|||||||
search bookmarks for ANY matching keyword
|
search bookmarks for ANY matching keyword
|
||||||
-S, --sall keyword [...]
|
-S, --sall keyword [...]
|
||||||
search bookmarks with ALL keywords
|
search bookmarks with ALL keywords
|
||||||
special keywords -
|
special keyword -
|
||||||
"tags" : list all tags alphabetically
|
|
||||||
"blank": list entries with empty title/tag
|
"blank": list entries with empty title/tag
|
||||||
--st, --stag keyword [...]
|
--st, --stag [...] search bookmarks by tag
|
||||||
search bookmarks by tag
|
list all tags alphabetically, if no arguments
|
||||||
|
|
||||||
encryption options:
|
encryption options:
|
||||||
-l, --lock [N] encrypt DB file with N (> 0, default 8)
|
-l, --lock [N] encrypt DB file with N (> 0, default 8)
|
||||||
@ -178,7 +177,7 @@ Shell completion scripts for Bash, Fish and Zsh can be found in respective subdi
|
|||||||
- Substrings match (`match` matches `rematched`) for URL, title and tags.
|
- Substrings match (`match` matches `rematched`) for URL, title and tags.
|
||||||
- `-s` : match any of the keywords in URL, title or tags.
|
- `-s` : match any of the keywords in URL, title or tags.
|
||||||
- `-S` : match all the keywords in URL, title or tags.
|
- `-S` : match all the keywords in URL, title or tags.
|
||||||
- `--st` : search bookmarks by tag.
|
- `--st` : search bookmarks by tag, or show all tags alphabetically.
|
||||||
- You can search bookmarks by tag (see [examples](#examples)).
|
- You can search bookmarks by tag (see [examples](#examples)).
|
||||||
- Search results are indexed serially. This index is different from actual database index of a bookmark record which is shown within `[]` after the URL.
|
- Search results are indexed serially. This index is different from actual database index of a bookmark record which is shown within `[]` after the URL.
|
||||||
- Auto DB compaction: when a record is deleted, the last record is moved to the index.
|
- Auto DB compaction: when a record is deleted, the last record is moved to the index.
|
||||||
@ -229,7 +228,7 @@ The last index is moved to the deleted index to keep the DB compact.
|
|||||||
Note the commas (,) before and after the tag. Comma is the tag delimiter in DB.
|
Note the commas (,) before and after the tag. Comma is the tag delimiter in DB.
|
||||||
11. List **all unique tags** alphabetically:
|
11. List **all unique tags** alphabetically:
|
||||||
|
|
||||||
$ buku -S tags
|
$ buku --st
|
||||||
12. **Encrypt or decrypt** DB with **custom number of iterations** (15) to generate key:
|
12. **Encrypt or decrypt** DB with **custom number of iterations** (15) to generate key:
|
||||||
|
|
||||||
$ buku -l 15
|
$ buku -l 15
|
||||||
|
45
buku
45
buku
@ -48,6 +48,7 @@ except ImportError:
|
|||||||
|
|
||||||
# Globals
|
# Globals
|
||||||
update = False # Update a bookmark in DB
|
update = False # Update a bookmark in DB
|
||||||
|
tagsearch = False # Search bookmarks by tag
|
||||||
titleData = None # Title fetched from a page
|
titleData = None # Title fetched from a page
|
||||||
titleManual = None # Manually add a title offline
|
titleManual = None # Manually add a title offline
|
||||||
description = None # Description of the bookmark
|
description = None # Description of the bookmark
|
||||||
@ -1019,7 +1020,7 @@ def printmsg(msg, level=None):
|
|||||||
|
|
||||||
|
|
||||||
class customUpdateAction(argparse.Action):
|
class customUpdateAction(argparse.Action):
|
||||||
"""Class to capture if an optional param
|
"""Class to capture if optional param 'update'
|
||||||
is actually used, even if sans arguments
|
is actually used, even if sans arguments
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -1031,8 +1032,20 @@ class customUpdateAction(argparse.Action):
|
|||||||
setattr(args, self.dest, values)
|
setattr(args, self.dest, values)
|
||||||
|
|
||||||
|
|
||||||
|
class customTagSearchAction(argparse.Action):
|
||||||
|
"""Class to capture if optional param 'stag'
|
||||||
|
is actually used, even if sans arguments
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __call__(self, parser, args, values, option_string=None):
|
||||||
|
global tagsearch
|
||||||
|
|
||||||
|
tagsearch = True
|
||||||
|
setattr(args, self.dest, values)
|
||||||
|
|
||||||
|
|
||||||
class customTitleAction(argparse.Action):
|
class customTitleAction(argparse.Action):
|
||||||
"""Class to capture if an optional param
|
"""Class to capture if optional param 'title'
|
||||||
is actually used, even if sans arguments
|
is actually used, even if sans arguments
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -1040,12 +1053,11 @@ class customTitleAction(argparse.Action):
|
|||||||
global titleManual
|
global titleManual
|
||||||
|
|
||||||
titleManual = ''
|
titleManual = ''
|
||||||
# NOTE: the following converts a None argument to an empty array []
|
|
||||||
setattr(args, self.dest, values)
|
setattr(args, self.dest, values)
|
||||||
|
|
||||||
|
|
||||||
class customDescAction(argparse.Action):
|
class customDescAction(argparse.Action):
|
||||||
"""Class to capture if an optional param
|
"""Class to capture if optional param 'comment'
|
||||||
is actually used, even if sans arguments
|
is actually used, even if sans arguments
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -1053,7 +1065,6 @@ class customDescAction(argparse.Action):
|
|||||||
global description
|
global description
|
||||||
|
|
||||||
description = ''
|
description = ''
|
||||||
# NOTE: the following converts a None argument to an empty array []
|
|
||||||
setattr(args, self.dest, values)
|
setattr(args, self.dest, values)
|
||||||
|
|
||||||
|
|
||||||
@ -1105,7 +1116,7 @@ argparser = ExtendedArgumentParser(
|
|||||||
formatter_class=argparse.RawTextHelpFormatter,
|
formatter_class=argparse.RawTextHelpFormatter,
|
||||||
usage='''buku [-a URL [tags ...]] [-u [N [URL tags ...]]]
|
usage='''buku [-a URL [tags ...]] [-u [N [URL tags ...]]]
|
||||||
[-t [...]] [-c [...]] [-d [N]] [-h]
|
[-t [...]] [-c [...]] [-d [N]] [-h]
|
||||||
[-s keyword [...]] [-S keyword [...]] [--st keyword [...]]
|
[-s keyword [...]] [-S keyword [...]] [--st [...]]
|
||||||
[-k [N]] [-l [N]] [-p [N]] [-f N]
|
[-k [N]] [-l [N]] [-p [N]] [-f N]
|
||||||
[-r oldtag [newtag ...]] [-j] [-o N] [-z]''',
|
[-r oldtag [newtag ...]] [-j] [-o N] [-z]''',
|
||||||
add_help=False
|
add_help=False
|
||||||
@ -1140,14 +1151,13 @@ search_group=argparser.add_argument_group(title="search options",
|
|||||||
search bookmarks for ANY matching keyword
|
search bookmarks for ANY matching keyword
|
||||||
-S, --sall keyword [...]
|
-S, --sall keyword [...]
|
||||||
search bookmarks with ALL keywords
|
search bookmarks with ALL keywords
|
||||||
special keywords -
|
special keyword -
|
||||||
"tags" : list all tags alphabetically
|
|
||||||
"blank": list entries with empty title/tag
|
"blank": list entries with empty title/tag
|
||||||
--st, --stag keyword [...]
|
--st, --stag [...] search bookmarks by tag
|
||||||
search bookmarks by tag''')
|
list all tags alphabetically, if no arguments''')
|
||||||
search_group.add_argument('-s', '--sany', nargs='+', metavar='keyword', help=argparse.SUPPRESS)
|
search_group.add_argument('-s', '--sany', nargs='+', metavar='keyword', help=argparse.SUPPRESS)
|
||||||
search_group.add_argument('-S', '--sall', nargs='+', metavar='keyword', help=argparse.SUPPRESS)
|
search_group.add_argument('-S', '--sall', nargs='+', metavar='keyword', help=argparse.SUPPRESS)
|
||||||
search_group.add_argument('--st', '--stag', nargs='+', dest='stag', metavar='keyword', help=argparse.SUPPRESS)
|
search_group.add_argument('--st', '--stag', nargs='*', dest='stag', action=customTagSearchAction, metavar='keyword', help=argparse.SUPPRESS)
|
||||||
|
|
||||||
# Encryption options
|
# Encryption options
|
||||||
crypto_group=argparser.add_argument_group(title="encryption options",
|
crypto_group=argparser.add_argument_group(title="encryption options",
|
||||||
@ -1255,17 +1265,18 @@ if args.sany is not None:
|
|||||||
|
|
||||||
# Search URLs, titles, tags with all keywords
|
# Search URLs, titles, tags with all keywords
|
||||||
if args.sall is not None:
|
if args.sall is not None:
|
||||||
if args.sall[0] == 'tags' and len(args.sall) == 1:
|
if args.sall[0] == 'blank' and len(args.sall) == 1:
|
||||||
showUniqueTags(cur)
|
|
||||||
elif args.sall[0] == 'blank' and len(args.sall) == 1:
|
|
||||||
printdb(cur, 0, True)
|
printdb(cur, 0, True)
|
||||||
else:
|
else:
|
||||||
searchdb(cur, args.sall, True)
|
searchdb(cur, args.sall, True)
|
||||||
|
|
||||||
# Search bookmarks by tag
|
# Search bookmarks by tag
|
||||||
if args.stag is not None:
|
if tagsearch == True:
|
||||||
tag = ',' + " ".join(args.stag) + ','
|
if len(args.stag) > 0:
|
||||||
searchTag(cur, tag)
|
tag = ',' + " ".join(args.stag) + ','
|
||||||
|
searchTag(cur, tag)
|
||||||
|
else:
|
||||||
|
showUniqueTags(cur)
|
||||||
|
|
||||||
# Update record
|
# Update record
|
||||||
if update == True:
|
if update == True:
|
||||||
|
14
buku.1
14
buku.1
@ -7,7 +7,7 @@ buku \- A private command-line bookmark manager. Your mini web!
|
|||||||
.br
|
.br
|
||||||
[-t [...]] [-c [...]] [-d [N]] [-h]
|
[-t [...]] [-c [...]] [-d [N]] [-h]
|
||||||
.br
|
.br
|
||||||
[-s keyword [...]] [-S keyword [...]] [--st keyword [...]]
|
[-s keyword [...]] [-S keyword [...]] [--st [...]]
|
||||||
.br
|
.br
|
||||||
[-k [N]] [-l [N]] [-p [N]] [-f N]
|
[-k [N]] [-l [N]] [-p [N]] [-f N]
|
||||||
.br
|
.br
|
||||||
@ -37,7 +37,7 @@ Search works in mysterious ways:
|
|||||||
- Substrings match ('match' matches 'rematched') for URL, title and tags.
|
- Substrings match ('match' matches 'rematched') for URL, title and tags.
|
||||||
- -s : match any of the keywords in URL, title or tags.
|
- -s : match any of the keywords in URL, title or tags.
|
||||||
- -S : match all the keywords in URL, title or tags.
|
- -S : match all the keywords in URL, title or tags.
|
||||||
- --st : search bookmarks by tag.
|
- --st : search bookmarks by tag, or show all tags alphabetically.
|
||||||
- You can search bookmarks by tag (see examples below).
|
- You can search bookmarks by tag (see examples below).
|
||||||
- Search results are indexed serially. This index is different from actual database index of a bookmark record which is shown within '[]' after the URL.
|
- Search results are indexed serially. This index is different from actual database index of a bookmark record which is shown within '[]' after the URL.
|
||||||
.PP
|
.PP
|
||||||
@ -83,14 +83,12 @@ Search bookmarks for ANY of the keyword(s) in URL, title or tags and show the re
|
|||||||
.BI \-S " " \--sall " keyword [...]"
|
.BI \-S " " \--sall " keyword [...]"
|
||||||
Search bookmarks with ALL keywords in URL, title or tags and show the results. Behaviour same as -s.
|
Search bookmarks with ALL keywords in URL, title or tags and show the results. Behaviour same as -s.
|
||||||
.br
|
.br
|
||||||
Special keywords:
|
Special keyword:
|
||||||
.br
|
|
||||||
"tags" : list all tags alphabetically
|
|
||||||
.br
|
.br
|
||||||
"blank": list entries with empty title/tag
|
"blank": list entries with empty title/tag
|
||||||
.TP
|
.TP
|
||||||
.BI \--st " " \--stag " keyword [...]"
|
.BI \--st " " \--stag " [...]"
|
||||||
Search bookmarks by tag.
|
Search bookmarks by tag. List all tags alphabetically, if no arguments.
|
||||||
.SH ENCRYPTION OPTIONS
|
.SH ENCRYPTION OPTIONS
|
||||||
.TP
|
.TP
|
||||||
.BI \-l " " \--lock " [N]"
|
.BI \-l " " \--lock " [N]"
|
||||||
@ -252,7 +250,7 @@ List \fBall unique tags\fR alphabetically:
|
|||||||
.PP
|
.PP
|
||||||
.EX
|
.EX
|
||||||
.IP
|
.IP
|
||||||
.B buku -S tags
|
.B buku --st
|
||||||
.PP
|
.PP
|
||||||
.IP 12. 4
|
.IP 12. 4
|
||||||
\fBEncrypt or decrypt\fR DB with \fBcustom number of iterations\fR (15) to generate key:
|
\fBEncrypt or decrypt\fR DB with \fBcustom number of iterations\fR (15) to generate key:
|
||||||
|
Loading…
Reference in New Issue
Block a user