From 5c890aa13698d0a77090678b3b30513cd641854c Mon Sep 17 00:00:00 2001 From: Arun Prakash Jana Date: Sun, 10 Jul 2016 21:15:43 +0530 Subject: [PATCH] Update search and delete. Add help. --- README.md | 2 ++ buku | 11 +++-------- buku.1 | 4 ++-- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 81550e9..57753d3 100644 --- a/README.md +++ b/README.md @@ -135,6 +135,7 @@ Please substitute `$version` with the appropriate package version. -d, --delete [...] delete bookmarks. Valid inputs: either a hyphenated single range (100-200), OR space-separated indices (100 15 200) + delete search results with search options delete all bookmarks, if no arguments -h, --help show this information and exit @@ -209,6 +210,7 @@ Please substitute `$version` with the appropriate package version. - **Delete** operation: - 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. + - Can delete bookmarks matching a search, when combined with any of the search options. - **Search** works in mysterious ways: - Case-insensitive. - Substrings match (`match` matches `rematched`) for URL, title and tags. diff --git a/buku b/buku index b8e80bc..7f747ec 100755 --- a/buku +++ b/buku @@ -621,10 +621,7 @@ class BukuDb: return if not self.json: - if not delete: - prompt(results, self.noninteractive, False) - else: - prompt(results, self.noninteractive, True) + prompt(results, self.noninteractive, delete) else: print(format_json(results, showOpt=self.showOpt)) @@ -644,10 +641,7 @@ class BukuDb: return if not self.json: - if not delete: - prompt(results, self.noninteractive, False) - else: - prompt(results, self.noninteractive, True) + prompt(results, self.noninteractive, delete) else: print(format_json(results, showOpt=self.showOpt)) @@ -1478,6 +1472,7 @@ if __name__ == '__main__': -d, --delete [...] delete bookmarks. Valid inputs: either a hyphenated single range (100-200), OR space-separated indices (100 15 200) + delete search results with search options delete all bookmarks, if no arguments -h, --help show this information and exit''') general_group.add_argument('-a', '--add', nargs='+', dest='addurl', metavar=('URL', 'tags'), help=argparse.SUPPRESS) diff --git a/buku.1 b/buku.1 index 5d3b989..ff541f3 100644 --- a/buku.1 +++ b/buku.1 @@ -25,7 +25,7 @@ URLs are unique in DB. The same URL cannot be added twice. You can update tags a \fIDelete\fR operation: - 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. - - 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 \fIUpdate\fR operation: - 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). .TP .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 .BI \-h " " \--help Show program help and exit.