hat.event.backends.lmdb.manager.main

 1import argparse
 2import sys
 3
 4from hat.event.backends.lmdb.manager import copy
 5from hat.event.backends.lmdb.manager import query
 6
 7
 8def create_argument_parser() -> argparse.ArgumentParser:
 9    parser = argparse.ArgumentParser()
10    subparsers = parser.add_subparsers(dest='action', required=True)
11
12    query.create_argument_parser(subparsers)
13    copy.create_argument_parser(subparsers)
14
15    return parser
16
17
18def main():
19    parser = create_argument_parser()
20    args = parser.parse_args()
21
22    if args.action == 'query':
23        query.query(args)
24
25    elif args.action == 'copy':
26        copy.copy(args)
27
28    else:
29        raise ValueError('unsupported action')
30
31
32if __name__ == '__main__':
33    sys.argv[0] = 'hat-event-lmdb-manager'
34    sys.exit(main())
def create_argument_parser() -> argparse.ArgumentParser:
 9def create_argument_parser() -> argparse.ArgumentParser:
10    parser = argparse.ArgumentParser()
11    subparsers = parser.add_subparsers(dest='action', required=True)
12
13    query.create_argument_parser(subparsers)
14    copy.create_argument_parser(subparsers)
15
16    return parser
def main():
19def main():
20    parser = create_argument_parser()
21    args = parser.parse_args()
22
23    if args.action == 'query':
24        query.query(args)
25
26    elif args.action == 'copy':
27        copy.copy(args)
28
29    else:
30        raise ValueError('unsupported action')