forked from juigilkishore/butterfly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbutterfly.py
36 lines (29 loc) · 892 Bytes
/
butterfly.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
36
import argparse
import os
import parser as conf_parser
from butterfly.db import actions as db_actions
DB_INIT = "db_init"
DB_DROP = "db_drop"
DB_UPGRADE = "db_upgrade"
RUN = "run"
arg_parser = argparse.ArgumentParser(description="Process the user input")
arg_parser.add_argument('--config', type=str, help="Configuration file")
arg_parser.add_argument('--action', type=str, help="Performs the action")
args = arg_parser.parse_args()
ACTION = args.action
config = args.config
config_path = os.path.dirname(os.path.abspath(__file__)) + "/etc/butterfly.conf"
if config:
config_path = config
config = conf_parser.parser(config_path)
def main():
if ACTION == DB_INIT:
db_actions.register_tables(config)
elif ACTION == DB_DROP:
db_actions.unregister_tables(config)
elif ACTION == RUN:
pass
else:
pass
if __name__ == "__main__":
main()