11import getpass
22import logging
3+ import os
34
45import typer
56from cryptography .fernet import Fernet
1415 print_as_envfile ,
1516)
1617
17- from . import web_server
1818from ._meta import PROJECT_NAME , __version__
1919from .core .settings import ApplicationSettings , MinimalApplicationSettings
2020from .services .invitations import (
@@ -50,7 +50,7 @@ def generate_key(
5050 export INVITATIONS_SECRET_KEY=$(invitations-maker generate-key)
5151 """
5252 assert ctx # nosec
53- print (Fernet .generate_key ().decode ()) # noqa: T201
53+ typer . echo (Fernet .generate_key ().decode ())
5454
5555
5656@main .command ()
@@ -133,7 +133,7 @@ def invite(
133133 base_url = settings .INVITATIONS_OSPARC_URL ,
134134 default_product = settings .INVITATIONS_DEFAULT_PRODUCT ,
135135 )
136- print (invitation_link ) # noqa: T201
136+ typer . echo (invitation_link )
137137
138138
139139@main .command ()
@@ -153,18 +153,8 @@ def extract(ctx: typer.Context, invitation_url: str):
153153 )
154154 assert invitation .product is not None # nosec
155155
156- print (invitation .model_dump_json (indent = 1 )) # noqa: T201
156+ typer . echo (invitation .model_dump_json (indent = 1 ))
157157
158- except (InvalidInvitationCodeError , ValidationError ):
159- _err_console .print ("[bold red]Invalid code[/bold red]" )
160-
161-
162- @main .command ()
163- def serve (
164- ctx : typer .Context ,
165- * ,
166- reload : bool = False ,
167- ):
168- """Starts server with http API"""
169- assert ctx # nosec
170- web_server .start (log_level = "info" , reload = reload )
158+ except (InvalidInvitationCodeError , ValidationError ) as err :
159+ typer .secho ("Invalid code" , fg = typer .colors .RED , bold = True , err = True )
160+ raise typer .Exit (os .EX_DATAERR ) from err
0 commit comments