-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
65 lines (63 loc) · 1.39 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
57
58
59
60
61
62
63
64
65
import os
import sys
# import modules
try:
import modules.initilizeNew as initn
import modules.sourceyTrack as st
import modules.commit as cmt
import modules.logCommits as lgcmts
except:
if len(sys.argv) == 0:
print("Error: No command args try -h")
else:
print("Repo initilized")
# Command help
commands = [
"sourcey -h",
"sourcey init",
"sourcey track",
"sourcey commit <commit name>",
"sourcey log"
]
# Get args
runcode = True
try:
if sys.argv[1].lower() == "-h":
runcode = False
for i in commands:
print(i)
if len(sys.argv) == 1:
runcode = False
except:
print("Error: no command inputed try \"sourcey -h\" to see the list of commands")
runcode = False
# Main Function
def main():
command = sys.argv
if command[1].lower() == "init":
if ".sourcey" not in os.listdir():
initn.initNew()
else:
print("Repo Already initilized in this directory")
if command[1].lower() == "track":
if ".sourcey" in os.listdir():
st.sourceyTrack()
else:
print("Repo not initilized")
if command[1].lower() == "commit":
if ".sourcey" in os.listdir():
cmt.commitChanges(command[2])
else:
print("Repo not ininitialized")
if command[1].lower() == "log":
if ".sourcey" in os.listdir():
print(lgcmts.logCommits())
else:
print("Repo not initilized")
# Checks to run the code
#try:
#if runcode == True:
# main()
#except:
# print("Error: Command not found")
main()