Call delete_all_bookmarks() directly
This commit is contained in:
parent
2d5bcd6272
commit
d84729f935
23
buku
23
buku
@ -807,13 +807,7 @@ class BukuDb:
|
|||||||
except IndexError:
|
except IndexError:
|
||||||
logger.error('Index out of bound')
|
logger.error('Index out of bound')
|
||||||
elif index == 0: # Remove the table
|
elif index == 0: # Remove the table
|
||||||
resp = input('Remove ALL bookmarks? (y/n): ')
|
return self.delete_all_bookmarks()
|
||||||
if resp != 'y':
|
|
||||||
print('No bookmarks deleted')
|
|
||||||
return False
|
|
||||||
|
|
||||||
self.delete_all_bookmarks()
|
|
||||||
print('All bookmarks deleted')
|
|
||||||
else: # Remove a single entry
|
else: # Remove a single entry
|
||||||
try:
|
try:
|
||||||
query = 'DELETE FROM bookmarks WHERE id = ?'
|
query = 'DELETE FROM bookmarks WHERE id = ?'
|
||||||
@ -854,12 +848,17 @@ class BukuDb:
|
|||||||
pos -= 1
|
pos -= 1
|
||||||
|
|
||||||
def delete_all_bookmarks(self):
|
def delete_all_bookmarks(self):
|
||||||
'''Should be called only inside delete_bookmark
|
'''Drops the bookmark table if it exists'''
|
||||||
Drops the bookmark table if it exists
|
|
||||||
'''
|
resp = input('Remove ALL bookmarks? (y/n): ')
|
||||||
|
if resp != 'y':
|
||||||
|
print('No bookmarks deleted')
|
||||||
|
return False
|
||||||
|
|
||||||
self.cur.execute('DROP TABLE if exists bookmarks')
|
self.cur.execute('DROP TABLE if exists bookmarks')
|
||||||
self.conn.commit()
|
self.conn.commit()
|
||||||
|
print('All bookmarks deleted')
|
||||||
|
return True
|
||||||
|
|
||||||
def print_bookmark(self, index, empty=False):
|
def print_bookmark(self, index, empty=False):
|
||||||
'''Print bookmark details at index or all bookmarks if index is 0
|
'''Print bookmark details at index or all bookmarks if index is 0
|
||||||
@ -945,7 +944,7 @@ class BukuDb:
|
|||||||
'''Replace orig tags with new tags in DB for all records.
|
'''Replace orig tags with new tags in DB for all records.
|
||||||
Remove orig tag if new tag is empty.
|
Remove orig tag if new tag is empty.
|
||||||
|
|
||||||
Params: original and new tags
|
Params: original and replacement tags
|
||||||
'''
|
'''
|
||||||
|
|
||||||
update = False
|
update = False
|
||||||
@ -2034,7 +2033,7 @@ if __name__ == '__main__':
|
|||||||
if len(args.delete) == 0:
|
if len(args.delete) == 0:
|
||||||
# Attempt delete-all only if search was not opted
|
# Attempt delete-all only if search was not opted
|
||||||
if not search_opted:
|
if not search_opted:
|
||||||
bdb.delete_bookmark(0)
|
bdb.delete_all_bookmarks()
|
||||||
elif len(args.delete) == 1 and '-' in args.delete[0]:
|
elif len(args.delete) == 1 and '-' in args.delete[0]:
|
||||||
vals = str(args.delete[0]).split('-')
|
vals = str(args.delete[0]).split('-')
|
||||||
if len(vals) == 2 and is_int(vals[0]) and is_int(vals[1]):
|
if len(vals) == 2 and is_int(vals[0]) and is_int(vals[1]):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user