forked from c29r3/icloud-hidemyemail-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli.py
47 lines (36 loc) · 946 Bytes
/
cli.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 asyncio
import click
from main import generate
from main import list
@click.group()
def cli():
pass
@click.command()
def generatecommand():
"Generate emails"
loop = asyncio.new_event_loop()
try:
loop.run_until_complete(generate())
except KeyboardInterrupt:
pass
@click.command()
@click.option(
"--active/--inactive", default=True, help="Filter Active / Inactive emails"
)
@click.option("--search", default=None, help="Search emails")
def listcommand(active, search):
"List emails"
loop = asyncio.new_event_loop()
try:
loop.run_until_complete(list(active, search))
except KeyboardInterrupt:
pass
cli.add_command(listcommand, name="list")
cli.add_command(generatecommand, name="generate")
if __name__ == "__main__":
cli()
loop = asyncio.new_event_loop()
try:
loop.run_until_complete(generate())
except KeyboardInterrupt:
pass