-
Notifications
You must be signed in to change notification settings - Fork 187
/
manage.py
executable file
·32 lines (24 loc) · 974 Bytes
/
manage.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env python3
"""Command-line tool for easily managing BinaryAlert."""
import argparse
import os
import sys
from cli import __version__
from cli.manager import Manager
def main() -> None:
"""Main command dispatcher."""
if not (sys.version_info.major == 3 and sys.version_info.minor in {6, 7}):
print('ERROR: Python 3.6/7 is required, found Python {}.{}.{}'.format(
sys.version_info.major, sys.version_info.minor, sys.version_info.micro))
exit(1)
manager = Manager()
parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument(
'command', choices=sorted(manager.commands), help=manager.help, metavar='command')
parser.add_argument(
'--version', action='version', version='BinaryAlert v{}'.format(__version__))
args = parser.parse_args()
os.environ['TF_IN_AUTOMATION'] = '1'
manager.run(args.command)
if __name__ == '__main__':
main()