-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathCLI.py
More file actions
43 lines (34 loc) · 995 Bytes
/
Copy pathCLI.py
File metadata and controls
43 lines (34 loc) · 995 Bytes
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
import click
from homework.patient import Patient, PatientCollection
@click.group()
def cli():
pass
@cli.command()
@click.argument("first_name")
@click.argument("last_name")
@click.option("--birth-date", help="Birth day")
@click.option("--phone", help="Phone")
@click.option("--document-type", help="Document type")
@click.option("--document-number", help="Document id")
def create(first_name, last_name, birth_date, phone, document_type, document_number):
par = Patient.create(first_name, last_name, birth_date, phone, document_type, document_number)
print(par.save())
click.echo(par)
@cli.command()
@click.option("--val", default=10, help="limit")
def show(val):
Pc = PatientCollection()
for pat in Pc.limit(val):
click.echo(pat)
@cli.command()
def count():
click.echo(PatientCollection().count())
# print(PatientCollection().count())
#
#
# cli.command(create)
# cli.command(show)
# cli.command(count)
cli()
# if __name__ == 'main':
# pass