implement '--clear-cache'
Effectively clears all cached values from the cache database by executing "DELETE FROM data" without any further user input.
This commit is contained in:
@@ -181,6 +181,18 @@ def main():
|
||||
if test:
|
||||
print("Example :", test[0])
|
||||
print()
|
||||
elif args.clear_cache:
|
||||
from . import cache
|
||||
log = logging.getLogger("cache")
|
||||
cnt = cache.clear()
|
||||
|
||||
if cnt is None:
|
||||
log.error("Database file not available")
|
||||
else:
|
||||
log.info(
|
||||
"Deleted %d %s from '%s'",
|
||||
cnt, "entry" if cnt == 1 else "entries", cache._path(),
|
||||
)
|
||||
else:
|
||||
if not args.urls and not args.inputfile:
|
||||
parser.error(
|
||||
|
||||
Reference in New Issue
Block a user