11from typing import Optional
22
33import typer
4+ from typing_extensions import Annotated
45
56from partifact .auth_token import get_token
67from partifact .config import Configuration
910app = typer .Typer ()
1011
1112profile_option = typer .Option (
12- None , help = "The AWS profile to use when getting the CodeArtifact token."
13+ "--profile" ,
14+ "-p" ,
15+ help = "The AWS profile to use when getting the CodeArtifact token." ,
1316)
1417
1518role_option = typer .Option (
16- None , help = "The AWS role to use when getting the CodeArtifact token."
19+ "--role" , "-r" , help = "The AWS role to use when getting the CodeArtifact token."
20+ )
21+
22+ should_configure_pip_option = typer .Option (
23+ "--configure-pip" ,
24+ "-c" ,
25+ help = "Set global.index-url for pip in addition to configuring poetry." ,
1726)
1827
1928
2029@app .command ()
2130def login (
2231 repository : str ,
23- profile : Optional [str ] = profile_option ,
24- role : Optional [str ] = role_option ,
32+ profile : Annotated [Optional [str ], profile_option ] = None ,
33+ role : Annotated [Optional [str ], role_option ] = None ,
34+ should_configure_pip : Annotated [bool , should_configure_pip_option ] = False ,
2535) -> None :
2636 """Log into CodeArtifact.
2737
@@ -30,7 +40,8 @@ def login(
3040 config = Configuration .load (repository , profile , role )
3141 token = get_token (config )
3242
33- configure_pip (config , token )
43+ if should_configure_pip :
44+ configure_pip (config , token )
3445 configure_poetry (repository , token )
3546
3647
0 commit comments