-
Notifications
You must be signed in to change notification settings - Fork 0
/
manage.py
35 lines (22 loc) · 822 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
33
34
35
import argparse
import os, sys
import dotenv
from proxycroak.app import create_app
from proxycroak.util import cards_db
dotenv.load_dotenv(".env")
BASE_DIR = os.path.join(os.path.dirname(__file__))
if BASE_DIR not in sys.path:
sys.path.append(BASE_DIR)
VALID_COMMANDS = ["updatesets"]
def main():
parser = argparse.ArgumentParser(description="Manage the proxycroak app")
parser.add_argument("command", type=str, help="The command to run")
args = parser.parse_args()
app = create_app()
if args.command.lower() not in VALID_COMMANDS:
print(f"'{args.command}' unrecognized command. Valid commands: {', '.join(VALID_COMMANDS)}")
elif args.command.lower() == "updatesets":
with app.app_context():
cards_db.update_sets()
if __name__ == '__main__':
main()