From f0af1300001d0e80b5c29073748465900eeee384 Mon Sep 17 00:00:00 2001 From: Mischievous Meerkat Date: Sat, 4 May 2019 21:39:05 +0530 Subject: [PATCH] Revert "Add --preserve option" --- README.md | 11 ++---- auto-completion/bash/buku-completion.bash | 1 - auto-completion/zsh/_buku | 1 - buku | 41 +++++------------------ 4 files changed, 10 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index 6f0b2fe..93cae5a 100644 --- a/README.md +++ b/README.md @@ -195,7 +195,6 @@ EDIT OPTIONS: clears description, if no arguments --immutable N disable web-fetch during auto-refresh N=0: mutable (default), N=1: immutable - --preserve [...] values to preserve for -u SEARCH OPTIONS: -s, --sany [...] find records with ANY matching keyword @@ -454,16 +453,10 @@ PROMPT KEYS: buku (? for help) g > 5 3-2 // remove tags at taglist indices 4 and 6-9 from tags in bookmarks at indices 5 and 2-3 buku (? for help) g 4 9-6 << 5 3-2 -37. **Update** URL but **preserve** title - - $ buku -u 479 --preserve title --url https://example.com -37. **Update** URL but **preserve** title and comment - - $ buku -u 479 --preserve title comment --url https://example.com -38. List bookmarks with **colored output**: +37. List bookmarks with **colored output**: $ buku --colors oKlxm -p -39. More **help**: +38. More **help**: $ buku -h $ man buku diff --git a/auto-completion/bash/buku-completion.bash b/auto-completion/bash/buku-completion.bash index b8971a0..77f967a 100644 --- a/auto-completion/bash/buku-completion.bash +++ b/auto-completion/bash/buku-completion.bash @@ -62,7 +62,6 @@ _buku () { -i --import --immutable -n --count - --preserve -r --sreg --replace -s --sany diff --git a/auto-completion/zsh/_buku b/auto-completion/zsh/_buku index 8dac5b4..4182aa3 100644 --- a/auto-completion/zsh/_buku +++ b/auto-completion/zsh/_buku @@ -30,7 +30,6 @@ args=( '(--np)--np[noninteractive mode]' '(-o --open)'{-o,--open}'[open bookmarks in browser]' '(--oa)--oa[browse all search results immediately]' - '(--preserve)--preserve[preserve options]' '(-p --print)'{-p,--print}'[show bookmark details]' '(-r --sreg)'{-r,--sreg}'[match a regular exression]:regex' '(--replace)--replace[replace a tag]:tag to replace' diff --git a/buku b/buku index 0365b8a..096ef48 100755 --- a/buku +++ b/buku @@ -755,8 +755,7 @@ class BukuDb: tags_in=None, desc=None, immutable=-1, - threads=4, - preserve=None): + threads=4): """Update an existing record at index. Update all records if index is 0 and url is not specified. @@ -780,8 +779,6 @@ class BukuDb: Disable title fetch from web if 1. Default is -1. threads : int, optional Number of threads to use to refresh full DB. Default is 4. - preserve : array of str, optional - Values to preserve. Can be "url","title","tag","tags", and "comment" Returns ------- @@ -795,23 +792,6 @@ class BukuDb: tag_modified = False ret = False - preserve_title = False - preserve_desc = False - if preserve is not None: - if len(preserve) == 0: - preserve = ['url', 'tag', 'comment', 'title'] - for option in preserve: - if option == "url": - url = None - elif option in ('tag', 'tags'): - tags_in = None - elif option == "comment": - desc = None - preserve_desc = True - elif option == "title": - title_in = None - preserve_title = True - # Update URL if passed as argument if url is not None and url != '': if index == 0: @@ -888,7 +868,7 @@ class BukuDb: else: LOGDBG('Title: [%s]', title_to_insert) - if not desc and not preserve_desc: + if not desc: if not pdesc: pdesc = '' query += ' desc = ?,' @@ -900,7 +880,7 @@ class BukuDb: self.print_rec(index) return ret - if title_to_insert is not None and not preserve_title: + if title_to_insert is not None: query += ' metadata = ?,' arguments += (title_to_insert,) to_update = True @@ -4783,7 +4763,6 @@ POSITIONAL ARGUMENTS: addarg('--title', nargs='*', help=hide) addarg('-c', '--comment', nargs='*', help=hide) addarg('--immutable', type=int, default=-1, choices={0, 1}, help=hide) - addarg('--preserve', nargs='*', help=hide) # -------------------- # SEARCH OPTIONS GROUP @@ -5244,7 +5223,7 @@ POSITIONAL ARGUMENTS: if not args.update: # Update all records only if search was not opted if not search_opted: - bdb.update_rec(0, url_in, title_in, tags, desc_in, args.immutable, args.threads, args.preserve) + bdb.update_rec(0, url_in, title_in, tags, desc_in, args.immutable, args.threads) elif update_search_results and search_results is not None: if not args.tacit: print('Updated results:\n') @@ -5259,8 +5238,7 @@ POSITIONAL ARGUMENTS: tags, desc_in, args.immutable, - args.threads, - args.preserve + args.threads ) # Commit at every 200th removal @@ -5278,8 +5256,7 @@ POSITIONAL ARGUMENTS: tags, desc_in, args.immutable, - args.threads, - args.preserve + args.threads ) elif '-' in idx: try: @@ -5296,8 +5273,7 @@ POSITIONAL ARGUMENTS: tags, desc_in, args.immutable, - args.threads, - args.preserve + args.threads ) else: for _id in range(vals[0], vals[1] + 1): @@ -5308,8 +5284,7 @@ POSITIONAL ARGUMENTS: tags, desc_in, args.immutable, - args.threads, - args.preserve + args.threads ) if INTERRUPTED: break