-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
109 lines (74 loc) · 3.37 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
from imports import *
print('''\n
____ _ _ _ _ _____ _
/ ___(_) |_| |__ _ _| |__ |_ _|__ ___ | |
| | _| | __| '_ \| | | | '_ \ | |/ _ \ / _ \| |
| |_| | | |_| | | | |_| | |_) | | | (_) | (_) | |
\____|_|\__|_| |_|\__,_|_.__/ |_|\___/ \___/|_|
\n''')
username=input("Enter Github Username >> ")
repository=Repository(username)
issues=Issues(username)
print("\n[-] You can visit {} for more information about the user...".format(repository.userurl))
time.sleep(2)
try:
# Creating the Main Menu
with open("./files/mainmenu.txt","r") as f:
print(f.read())
f.close()
repo_list=["[{}] {}".format(i[0]+1,i[1]) for i in enumerate(repository.listAllRepos().keys())]
for i in repo_list:
print(i)
selected_repo_number=int(input("Enter Repository Number to select the Repository >> "))
for repo in repo_list:
if str(selected_repo_number) in repo:
selected_reponame = repo.split(" ")[-1]
except KeyboardInterrupt:
print("\nLeaving Github Tool...")
sys.exit(0)
while True:
try:
with open("./files/helptext.txt",'r') as f:
print(f.read())
f.close()
repo_option = int(input("Enter Option Number >> "))
if repo_option==1:
with open("./files/repooperations.txt","r") as f:
print(f.read())
f.close()
repo_fuction_option=int(input("Enter Option Number to Perform the Operation on {} Repository >> ".format(selected_reponame)))
if repo_fuction_option==1:
repository.downloadRepo(selected_reponame)
elif repo_fuction_option==2:
repository.downloadAndExtractRepo(selected_reponame)
elif repo_fuction_option==3:
repository.displayLicense(selected_reponame)
# Option-2: See Issues
elif repo_option==2:
issuesitem=issues.listIssues(selected_reponame)
list_of_issues=["[{}] {}".format(i[0]+1,i[1]) for i in enumerate(issuesitem.keys())]
if len(list_of_issues)==0:
print("\nNo Issues in This Repository\n")
else:
for i in list_of_issues:
print(i)
issue_number=int(input("Enter Issue Number to Read aboy the Issue >> "))
for issue in list_of_issues:
if str(issue_number) in issue:
selected_issue=issue.split("] ")[-1]
issues.readIssue(selected_issue)
# Option-3: Select Different Repository
elif repo_option==3:
repo_list=["[{}] {}".format(i[0]+1,i[1]) for i in enumerate(repository.listAllRepos().keys())]
for i in repo_list:
print(i)
selected_repo_number=int(input("Enter Repository Number to select the Repository >> "))
for repo in repo_list:
if str(selected_repo_number) in repo:
selected_reponame = repo.split(" ")[-1]
# If Wrong Option is selected
else:
print("<< Wrong Option ! Choose Between 1 - 3 >>")
except KeyboardInterrupt:
print("\nLeaving Github Tool...")
break