Update search and delete. Add help.

This commit is contained in:
Arun Prakash Jana 2016-07-10 21:15:43 +05:30
parent 77aadffa9f
commit 5c890aa136
3 changed files with 7 additions and 10 deletions

View File

@ -135,6 +135,7 @@ Please substitute `$version` with the appropriate package version.
-d, --delete [...] delete bookmarks. Valid inputs: either -d, --delete [...] delete bookmarks. Valid inputs: either
a hyphenated single range (100-200), a hyphenated single range (100-200),
OR space-separated indices (100 15 200) OR space-separated indices (100 15 200)
delete search results with search options
delete all bookmarks, if no arguments delete all bookmarks, if no arguments
-h, --help show this information and exit -h, --help show this information and exit
@ -209,6 +210,7 @@ Please substitute `$version` with the appropriate package version.
- **Delete** operation: - **Delete** operation:
- When a record is deleted, the last record is moved to the index. - When a record is deleted, the last record is moved to the index.
- Delete doesn't work with range and indices provided together as arguments. It's an intentional decision to avoid extra sorting, in-range checks and to keep the auto-DB compaction functionality intact. On the same lines, indices are deleted in descending order. - Delete doesn't work with range and indices provided together as arguments. It's an intentional decision to avoid extra sorting, in-range checks and to keep the auto-DB compaction functionality intact. On the same lines, indices are deleted in descending order.
- Can delete bookmarks matching a search, when combined with any of the search options.
- **Search** works in mysterious ways: - **Search** works in mysterious ways:
- Case-insensitive. - Case-insensitive.
- Substrings match (`match` matches `rematched`) for URL, title and tags. - Substrings match (`match` matches `rematched`) for URL, title and tags.

11
buku
View File

@ -621,10 +621,7 @@ class BukuDb:
return return
if not self.json: if not self.json:
if not delete: prompt(results, self.noninteractive, delete)
prompt(results, self.noninteractive, False)
else:
prompt(results, self.noninteractive, True)
else: else:
print(format_json(results, showOpt=self.showOpt)) print(format_json(results, showOpt=self.showOpt))
@ -644,10 +641,7 @@ class BukuDb:
return return
if not self.json: if not self.json:
if not delete: prompt(results, self.noninteractive, delete)
prompt(results, self.noninteractive, False)
else:
prompt(results, self.noninteractive, True)
else: else:
print(format_json(results, showOpt=self.showOpt)) print(format_json(results, showOpt=self.showOpt))
@ -1478,6 +1472,7 @@ if __name__ == '__main__':
-d, --delete [...] delete bookmarks. Valid inputs: either -d, --delete [...] delete bookmarks. Valid inputs: either
a hyphenated single range (100-200), a hyphenated single range (100-200),
OR space-separated indices (100 15 200) OR space-separated indices (100 15 200)
delete search results with search options
delete all bookmarks, if no arguments delete all bookmarks, if no arguments
-h, --help show this information and exit''') -h, --help show this information and exit''')
general_group.add_argument('-a', '--add', nargs='+', dest='addurl', metavar=('URL', 'tags'), help=argparse.SUPPRESS) general_group.add_argument('-a', '--add', nargs='+', dest='addurl', metavar=('URL', 'tags'), help=argparse.SUPPRESS)

4
buku.1
View File

@ -25,7 +25,7 @@ URLs are unique in DB. The same URL cannot be added twice. You can update tags a
\fIDelete\fR operation: \fIDelete\fR operation:
- When a record is deleted, the last record is moved to the index. - When a record is deleted, the last record is moved to the index.
- Delete doesn't work with range and indices provided together as arguments. It's an intentional decision to avoid extra sorting, in-range checks and to keep the auto-DB compaction functionality intact. On the same lines, indices are deleted in descending order. - Delete doesn't work with range and indices provided together as arguments. It's an intentional decision to avoid extra sorting, in-range checks and to keep the auto-DB compaction functionality intact. On the same lines, indices are deleted in descending order.
- Can delete the search results, when any of the search flag is combined with -d. - Can delete bookmarks matching a search, when combined with any of the search options.
.PP .PP
\fIUpdate\fR operation: \fIUpdate\fR operation:
- If --title, --tag or --comment is passed without argument, clear the corresponding field from DB. - If --title, --tag or --comment is passed without argument, clear the corresponding field from DB.
@ -57,7 +57,7 @@ in DB. If
and other options are omitted, all titles are refreshed from the web. Works with update modifiers for the fields url, title, tag and comment. If only N is passed without any edit options, title is fetched and updated (if not empty). and other options are omitted, all titles are refreshed from the web. Works with update modifiers for the fields url, title, tag and comment. If only N is passed without any edit options, title is fetched and updated (if not empty).
.TP .TP
.BI \-d " " \--delete " [...]" .BI \-d " " \--delete " [...]"
Delete bookmarks. You can either provide a single hyphenated range (e.g. 100-200) or a space-separated list of indices (e.g. 5 6 23 4 110 45). Note that range and list don't work together. Delete bookmarks. You can either provide a single hyphenated range (e.g. 100-200) or a space-separated list of indices (e.g. 5 6 23 4 110 45). Note that range and list don't work together. Deletes search results when combined with search options.
.TP .TP
.BI \-h " " \--help .BI \-h " " \--help
Show program help and exit. Show program help and exit.