Merge pull request #384 from jarun/revert-383-master
Revert "Add --preserve option"
This commit is contained in:
commit
a8acc58c2f
11
README.md
11
README.md
@ -195,7 +195,6 @@ EDIT OPTIONS:
|
|||||||
clears description, if no arguments
|
clears description, if no arguments
|
||||||
--immutable N disable web-fetch during auto-refresh
|
--immutable N disable web-fetch during auto-refresh
|
||||||
N=0: mutable (default), N=1: immutable
|
N=0: mutable (default), N=1: immutable
|
||||||
--preserve [...] values to preserve for -u
|
|
||||||
|
|
||||||
SEARCH OPTIONS:
|
SEARCH OPTIONS:
|
||||||
-s, --sany [...] find records with ANY matching keyword
|
-s, --sany [...] find records with ANY matching keyword
|
||||||
@ -454,16 +453,10 @@ PROMPT KEYS:
|
|||||||
buku (? for help) g > 5 3-2
|
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
|
// 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
|
buku (? for help) g 4 9-6 << 5 3-2
|
||||||
37. **Update** URL but **preserve** title
|
37. List bookmarks with **colored output**:
|
||||||
|
|
||||||
$ 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**:
|
|
||||||
|
|
||||||
$ buku --colors oKlxm -p
|
$ buku --colors oKlxm -p
|
||||||
39. More **help**:
|
38. More **help**:
|
||||||
|
|
||||||
$ buku -h
|
$ buku -h
|
||||||
$ man buku
|
$ man buku
|
||||||
|
@ -62,7 +62,6 @@ _buku () {
|
|||||||
-i --import
|
-i --import
|
||||||
--immutable
|
--immutable
|
||||||
-n --count
|
-n --count
|
||||||
--preserve
|
|
||||||
-r --sreg
|
-r --sreg
|
||||||
--replace
|
--replace
|
||||||
-s --sany
|
-s --sany
|
||||||
|
@ -30,7 +30,6 @@ args=(
|
|||||||
'(--np)--np[noninteractive mode]'
|
'(--np)--np[noninteractive mode]'
|
||||||
'(-o --open)'{-o,--open}'[open bookmarks in browser]'
|
'(-o --open)'{-o,--open}'[open bookmarks in browser]'
|
||||||
'(--oa)--oa[browse all search results immediately]'
|
'(--oa)--oa[browse all search results immediately]'
|
||||||
'(--preserve)--preserve[preserve options]'
|
|
||||||
'(-p --print)'{-p,--print}'[show bookmark details]'
|
'(-p --print)'{-p,--print}'[show bookmark details]'
|
||||||
'(-r --sreg)'{-r,--sreg}'[match a regular exression]:regex'
|
'(-r --sreg)'{-r,--sreg}'[match a regular exression]:regex'
|
||||||
'(--replace)--replace[replace a tag]:tag to replace'
|
'(--replace)--replace[replace a tag]:tag to replace'
|
||||||
|
41
buku
41
buku
@ -755,8 +755,7 @@ class BukuDb:
|
|||||||
tags_in=None,
|
tags_in=None,
|
||||||
desc=None,
|
desc=None,
|
||||||
immutable=-1,
|
immutable=-1,
|
||||||
threads=4,
|
threads=4):
|
||||||
preserve=None):
|
|
||||||
"""Update an existing record at index.
|
"""Update an existing record at index.
|
||||||
|
|
||||||
Update all records if index is 0 and url is not specified.
|
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.
|
Disable title fetch from web if 1. Default is -1.
|
||||||
threads : int, optional
|
threads : int, optional
|
||||||
Number of threads to use to refresh full DB. Default is 4.
|
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
|
Returns
|
||||||
-------
|
-------
|
||||||
@ -795,23 +792,6 @@ class BukuDb:
|
|||||||
tag_modified = False
|
tag_modified = False
|
||||||
ret = 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
|
# Update URL if passed as argument
|
||||||
if url is not None and url != '':
|
if url is not None and url != '':
|
||||||
if index == 0:
|
if index == 0:
|
||||||
@ -888,7 +868,7 @@ class BukuDb:
|
|||||||
else:
|
else:
|
||||||
LOGDBG('Title: [%s]', title_to_insert)
|
LOGDBG('Title: [%s]', title_to_insert)
|
||||||
|
|
||||||
if not desc and not preserve_desc:
|
if not desc:
|
||||||
if not pdesc:
|
if not pdesc:
|
||||||
pdesc = ''
|
pdesc = ''
|
||||||
query += ' desc = ?,'
|
query += ' desc = ?,'
|
||||||
@ -900,7 +880,7 @@ class BukuDb:
|
|||||||
self.print_rec(index)
|
self.print_rec(index)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
if title_to_insert is not None and not preserve_title:
|
if title_to_insert is not None:
|
||||||
query += ' metadata = ?,'
|
query += ' metadata = ?,'
|
||||||
arguments += (title_to_insert,)
|
arguments += (title_to_insert,)
|
||||||
to_update = True
|
to_update = True
|
||||||
@ -4783,7 +4763,6 @@ POSITIONAL ARGUMENTS:
|
|||||||
addarg('--title', nargs='*', help=hide)
|
addarg('--title', nargs='*', help=hide)
|
||||||
addarg('-c', '--comment', nargs='*', help=hide)
|
addarg('-c', '--comment', nargs='*', help=hide)
|
||||||
addarg('--immutable', type=int, default=-1, choices={0, 1}, help=hide)
|
addarg('--immutable', type=int, default=-1, choices={0, 1}, help=hide)
|
||||||
addarg('--preserve', nargs='*', help=hide)
|
|
||||||
|
|
||||||
# --------------------
|
# --------------------
|
||||||
# SEARCH OPTIONS GROUP
|
# SEARCH OPTIONS GROUP
|
||||||
@ -5244,7 +5223,7 @@ POSITIONAL ARGUMENTS:
|
|||||||
if not args.update:
|
if not args.update:
|
||||||
# Update all records only if search was not opted
|
# Update all records only if search was not opted
|
||||||
if not search_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:
|
elif update_search_results and search_results is not None:
|
||||||
if not args.tacit:
|
if not args.tacit:
|
||||||
print('Updated results:\n')
|
print('Updated results:\n')
|
||||||
@ -5259,8 +5238,7 @@ POSITIONAL ARGUMENTS:
|
|||||||
tags,
|
tags,
|
||||||
desc_in,
|
desc_in,
|
||||||
args.immutable,
|
args.immutable,
|
||||||
args.threads,
|
args.threads
|
||||||
args.preserve
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Commit at every 200th removal
|
# Commit at every 200th removal
|
||||||
@ -5278,8 +5256,7 @@ POSITIONAL ARGUMENTS:
|
|||||||
tags,
|
tags,
|
||||||
desc_in,
|
desc_in,
|
||||||
args.immutable,
|
args.immutable,
|
||||||
args.threads,
|
args.threads
|
||||||
args.preserve
|
|
||||||
)
|
)
|
||||||
elif '-' in idx:
|
elif '-' in idx:
|
||||||
try:
|
try:
|
||||||
@ -5296,8 +5273,7 @@ POSITIONAL ARGUMENTS:
|
|||||||
tags,
|
tags,
|
||||||
desc_in,
|
desc_in,
|
||||||
args.immutable,
|
args.immutable,
|
||||||
args.threads,
|
args.threads
|
||||||
args.preserve
|
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
for _id in range(vals[0], vals[1] + 1):
|
for _id in range(vals[0], vals[1] + 1):
|
||||||
@ -5308,8 +5284,7 @@ POSITIONAL ARGUMENTS:
|
|||||||
tags,
|
tags,
|
||||||
desc_in,
|
desc_in,
|
||||||
args.immutable,
|
args.immutable,
|
||||||
args.threads,
|
args.threads
|
||||||
args.preserve
|
|
||||||
)
|
)
|
||||||
if INTERRUPTED:
|
if INTERRUPTED:
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user