-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.py
59 lines (44 loc) · 1.33 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
from rich.prompt import IntPrompt, Prompt
from rich.theme import Theme
from rich.highlighter import RegexHighlighter
from rich.console import Console
from rich.pretty import pprint
from rich.prompt import Confirm
from rich.text import Text
from cleanup import EmailFetcher, Deleter
import typer
app = typer.Typer()
console = Console()
def send_email():
raise NotImplementedError
def analyze_emails():
raise NotImplementedError
def archive_emails():
option = IntPrompt.ask("Enter the number of emails to fetch:", default=1000)
emails = EmailFetcher().get(option)
pprint(emails)
Deleter(emails=emails).run()
def label_emails():
raise NotImplementedError
def main():
"""
Get the number of emails, count the amount of emails per sender, and delete the emails from
the top senders.
"""
action = Prompt.ask(
"What would you like to do?",
choices=["send_email", "analyze_emails", "archive_emails", "label_emails"],
default="analyze_emails",
)
if action == "send_email":
send_email()
elif action == "analyze_emails":
analyze_emails()
elif action == "archive_emails":
archive_emails()
elif action == "label_emails":
label_emails()
else:
raise ValueError(f"Unknown action: {action}")
if __name__ == "__main__":
main()