All checks were successful
Test execution / Test-all (push) Successful in 2m3s
Add the command line tool `dump-things-gitaudit-rebuild-index`. It can be used to rebuild indices of gitaudit databases. This is only useful for maintenance operations. The gitaudit-backend code will automatically build indices, if they are not existing.
29 lines
658 B
Python
29 lines
658 B
Python
from __future__ import annotations
|
|
|
|
import sys
|
|
from argparse import ArgumentParser
|
|
from pathlib import Path
|
|
|
|
from dump_things_service.audit.gitaudit import GitAuditBackend
|
|
|
|
|
|
parser = ArgumentParser(
|
|
prog='Rebuild the index of a `gitaudit`-database',
|
|
description='This command rebuilds the index of a `gitaudit`-database.'
|
|
)
|
|
parser.add_argument(
|
|
'audit_store',
|
|
help='The directory in which the `gitaudit`-database is located.'
|
|
)
|
|
|
|
|
|
def main():
|
|
arguments = parser.parse_args()
|
|
|
|
audit_backend = GitAuditBackend(Path(arguments.audit_store))
|
|
audit_backend._rebuild_index()
|
|
return 0
|
|
|
|
|
|
if __name__ == '__main__':
|
|
sys.exit(main())
|