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 1
1
import click
2
2
3
3
from paperspace import client , config
4
+ from paperspace .cli import common
4
5
from paperspace .cli .cli import cli
5
6
from paperspace .cli .validators import validate_email
6
7
from paperspace .commands import login as login_commands
@@ -39,7 +40,7 @@ def logout():
39
40
40
41
41
42
@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: " ) )
43
44
def save_api_key (api_key ):
44
45
command = login_commands .SetApiKeyCommand ()
45
46
command .execute (api_key )
Original file line number Diff line number Diff line change
1
+ import getpass
2
+
1
3
import click
2
4
from click_didyoumean import DYMMixin
3
5
from click_help_colors import HelpColorsGroup
@@ -18,3 +20,13 @@ def del_if_value_is_none(dict_):
18
20
19
21
class ClickGroup (DYMMixin , HelpColorsGroup ):
20
22
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