This repository was archived by the owner on Aug 11, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 11import click
22
33from paperspace import client , config
4+ from paperspace .cli import common
45from paperspace .cli .cli import cli
56from paperspace .cli .validators import validate_email
67from paperspace .commands import login as login_commands
@@ -39,7 +40,7 @@ def logout():
3940
4041
4142@cli .command ("apiKey" , help = "Save your api key" )
42- @click .argument ("api_key" )
43+ @click .argument ("api_key" , required = False , callback = common . prompt_for_secret ( "API Key: " ) )
4344def save_api_key (api_key ):
4445 command = login_commands .SetApiKeyCommand ()
4546 command .execute (api_key )
Original file line number Diff line number Diff line change 1+ import getpass
2+
13import click
24from click_didyoumean import DYMMixin
35from click_help_colors import HelpColorsGroup
@@ -18,3 +20,13 @@ def del_if_value_is_none(dict_):
1820
1921class ClickGroup (DYMMixin , HelpColorsGroup ):
2022 pass
23+
24+
25+ def prompt_for_secret (prompt ):
26+ def callback_fun (ctx , param , value ):
27+ if value is None :
28+ value = getpass .getpass (prompt )
29+
30+ return value
31+
32+ return callback_fun
You can’t perform that action at this time.
0 commit comments