Skip to content
Snippets Groups Projects
Commit a327bcfd authored by Stefano Zacchiroli's avatar Stefano Zacchiroli
Browse files

CLI: add clean command to remove on-disk cache files

Closes T2669
parent a8af4ad5
No related branches found
No related tags found
No related merge requests found
......@@ -132,3 +132,21 @@ def mount(ctx, swhids, path, foreground):
)
asyncio.run(fuse.main(swhids, path, ctx.obj["config"]))
@fuse.command()
@click.pass_context
def clean(ctx):
"""Clean on-disk cache(s)
"""
def rm_cache(conf, cache_name):
try:
conf["cache"][cache_name]["path"].unlink(missing_ok=True)
except KeyError:
pass
conf = ctx.obj["config"]
for cache_name in ["blob", "metadata"]:
rm_cache(conf, cache_name)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment