Skip to content

Commit 40632c8

Browse files
committed
BugFix and main() added
1 parent 5df5dce commit 40632c8

File tree

1 file changed

+36
-32
lines changed

1 file changed

+36
-32
lines changed

main.py

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ def compareLists():
9090
):
9191
nUnfollorers += 1
9292
print(
93-
f"""{(len(str(len(followings)))-len(str(nUnfollorers))) * ' '}{nUnfollorers}. {Fore.RED}{Style.BRIGHT}
94-
{following.upper()}{Style.RESET_ALL} {(len(max(followings))+2-len(following)) * ' '}
95-
doesn't follow you back."""
93+
f"{(len(str(len(followings)))-len(str(nUnfollorers))) * ' '}{nUnfollorers}. {Fore.RED}{Style.BRIGHT}"
94+
f"{following.upper()}{Style.RESET_ALL} {(len(max(followings))+2-len(following)) * ' '}"
95+
"doesn't follow you back."
9696
)
9797

9898
if nUnfollorers == 0:
@@ -121,36 +121,40 @@ def about():
121121
)
122122

123123

124-
actions = {
125-
"Find unfollowers": compareLists,
126-
"Print whitelist": printWhitelist,
127-
"About": about,
128-
f"{Fore.RED}Exit{Fore.RESET}": exit,
129-
}
124+
def main():
125+
actions = {
126+
"Find unfollowers": compareLists,
127+
"Print whitelist": printWhitelist,
128+
"About": about,
129+
f"{Fore.RED}Exit{Fore.RESET}": exit,
130+
}
130131

131-
prevInputInvalid = 0
132-
while 1:
133-
clearCLI()
132+
prevInputInvalid = 0
133+
while 1:
134+
clearCLI()
134135

135-
# Print all the actions
136-
for n, i in enumerate(actions.keys()):
137-
print(f" {n+1}. {Style.BRIGHT}{i}{Style.RESET_ALL}")
138-
print()
136+
# Print all the actions
137+
for n, i in enumerate(actions.keys()):
138+
print(f" {n+1}. {Style.BRIGHT}{i}{Style.RESET_ALL}")
139+
print()
139140

140-
# Print something if the previrous input was not valid
141-
if prevInputInvalid:
142-
printColored("Invalid input!", Fore.RED)
143-
prevInputInvalid = 0
141+
# Print something if the previrous input was not valid
142+
if prevInputInvalid:
143+
printColored("Invalid input!", Fore.RED)
144+
prevInputInvalid = 0
144145

145-
# Ask and run user input
146-
try:
147-
selection = (
148-
int(input(f"{Fore.YELLOW}Select what you wanna do: {Fore.RESET}")) - 1
149-
)
150-
clearCLI()
151-
tuple(actions.values())[selection]()
152-
input(
153-
f"{Fore.YELLOW}{Style.DIM}\n(Press ENTER to go back to menu){Style.RESET_ALL}"
154-
)
155-
except (IndexError, ValueError):
156-
prevInputInvalid = 1
146+
# Ask and run user input
147+
try:
148+
selection = (
149+
int(input(f"{Fore.YELLOW}Select what you wanna do: {Fore.RESET}")) - 1
150+
)
151+
clearCLI()
152+
tuple(actions.values())[selection]()
153+
input(
154+
f"{Fore.YELLOW}{Style.DIM}\n(Press ENTER to go back to menu){Style.RESET_ALL}"
155+
)
156+
except (IndexError, ValueError):
157+
prevInputInvalid = 1
158+
159+
160+
main()

0 commit comments

Comments
 (0)