forked from cycodehq/cycode-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprompts.py
More file actions
59 lines (37 loc) · 1.84 KB
/
Copy pathprompts.py
File metadata and controls
59 lines (37 loc) · 1.84 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
from typing import Optional
import typer
from cycode.cli import consts
from cycode.cli.utils.string_utils import obfuscate_text
def get_client_id_input(current_client_id: Optional[str]) -> Optional[str]:
prompt_text = 'Cycode Client ID'
prompt_suffix = ' []: '
if current_client_id:
prompt_suffix = f' [{obfuscate_text(current_client_id)}]: '
new_client_id = typer.prompt(text=prompt_text, prompt_suffix=prompt_suffix, default='', show_default=False)
return new_client_id or current_client_id
def get_client_secret_input(current_client_secret: Optional[str]) -> Optional[str]:
prompt_text = 'Cycode Client Secret'
prompt_suffix = ' []: '
if current_client_secret:
prompt_suffix = f' [{obfuscate_text(current_client_secret)}]: '
new_client_secret = typer.prompt(text=prompt_text, prompt_suffix=prompt_suffix, default='', show_default=False)
return new_client_secret or current_client_secret
def get_app_url_input(current_app_url: Optional[str]) -> str:
prompt_text = 'Cycode APP URL'
default = consts.DEFAULT_CYCODE_APP_URL
if current_app_url:
default = current_app_url
return typer.prompt(text=prompt_text, default=default, type=str)
def get_api_url_input(current_api_url: Optional[str]) -> str:
prompt_text = 'Cycode API URL'
default = consts.DEFAULT_CYCODE_API_URL
if current_api_url:
default = current_api_url
return typer.prompt(text=prompt_text, default=default, type=str)
def get_id_token_input(current_id_token: Optional[str]) -> Optional[str]:
prompt_text = 'Cycode ID Token'
prompt_suffix = ' []: '
if current_id_token:
prompt_suffix = f' [{obfuscate_text(current_id_token)}]: '
new_id_token = typer.prompt(text=prompt_text, prompt_suffix=prompt_suffix, default='', show_default=False)
return new_id_token or current_id_token