forked from hackgwinnett/bogey-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
47 lines (36 loc) · 1.06 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
import commands
import groups
import rank
import sys
import export
import clear
commands.add("help", "", "displays all cli commands")
commands.add("addgroup", "name, members", "adds a group file to the local database")
commands.add("score", "name", "enters ranking sequence for a given group")
commands.add("rank", "category", "lists groups from highest to lowest score in the given category")
commands.add("export", "", "exports rankings for all categories into a CSV file")
commands.add("clear", "", "clears filetree")
args = sys.argv
if len(args) < 2:
commands.display()
exit()
c = args[1].lower()
if c == "help":
commands.display()
if c == "addgroup":
name = args[2]
members = args[3]
groups.add(name, members)
if c == "score":
name = args[2]
groups.rank(name)
if c == "rank":
category = args[2].lower()
rank.rank(category)
if c == "export":
export.exportAll()
if c == "clear":
clear.clear()
if not commands.commandContains(c):
print("invalid command: " + c)
exit()