-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathmain.py
executable file
·57 lines (40 loc) · 1.46 KB
/
main.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/python3
import argparse
from textwrap import dedent
import logging
def launch_gui(args=None):
"""Launch the system's gui"""
from JMTracker import Tracker
tracker = Tracker()
tracker.main_gui()
return
if __name__ == "__main__":
parser = argparse.ArgumentParser(description=dedent("""
====== Job Market Application Tracker =====
A simple tool to keep track of new postings, those I'm interested
in and the deadlines.
-----------------
UPDATING METHODS
-----------------
- Update the current local collection of job postings from
econjobmarket.org and aeaweb.org.
./main.py update
"""), formatter_class=argparse.RawTextHelpFormatter)
available_actions = {
'gui': launch_gui,
}
parser.add_argument("--action", type=str, choices=available_actions.keys(),
help="action to execute", default='gui')
parser.add_argument("--debug", action="store_true",
help="Debug log level")
args = parser.parse_args()
action = args.action
if action not in available_actions.keys():
raise ValueError(f"Argument option for action {action} not accepted")
# process debug
logging_level = logging.DEBUG if args.debug else logging.INFO
FORMAT = "[%(filename)s:%(lineno)s][%(levelname)s]\t %(message)s"
logging.basicConfig(format=FORMAT, level=logging_level)
# Process
available_actions[action](args)
print("Done")