harbor_cli.output.prompts
Attributes
T = TypeVar('T')
module-attribute
P = ParamSpec('P')
module-attribute
ENUMERATION_WARNING = f'Unconstrained resource enumeration detected. It is recommended to use {render_cli_option('--query')} or {render_cli_option('--limit')} to constrain the results. Continue?'
module-attribute
Classes
Functions
no_headless(f: Callable[P, T]) -> Callable[P, T]
Decorator that causes application to exit if called from a headless environment.
Source code in harbor_cli/output/prompts.py
is_headless() -> bool
Determines if we are running in a headless environment (e.g. CI, Docker, etc.)
Source code in harbor_cli/output/prompts.py
prompt_msg(*msgs: str) -> str
str_prompt(prompt: str, default: Any = ..., password: bool = False, show_default: bool = True, choices: list[str] | None = None, empty_ok: bool = False, **kwargs: Any) -> str
Prompts the user for a string input. Optionally controls for empty input. Loops until a valid input is provided.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
prompt |
str
|
Prompt to display to the user. |
required |
default |
Any
|
Default value to use if the user does not provide input. If not provided, the user will be required to provide input. |
...
|
password |
bool
|
Whether to hide the input, by default False |
False
|
show_default |
bool
|
Whether to show the default value, by default True
|
True
|
empty_ok |
bool
|
Whether to allow input consisting of only whitespace, by default False |
False
|
Source code in harbor_cli/output/prompts.py
int_prompt(prompt: str, default: int | None = None, show_default: bool = True, min: int | None = None, max: int | None = None, show_range: bool = True, **kwargs: Any) -> int
Source code in harbor_cli/output/prompts.py
float_prompt(prompt: str, default: float | None = None, show_default: bool = True, min: float | None = None, max: float | None = None, show_range: bool = True, **kwargs: Any) -> float
Source code in harbor_cli/output/prompts.py
bool_prompt(prompt: str, default: Any = ..., show_default: bool = True, warning: bool = False, **kwargs: Any) -> bool
Source code in harbor_cli/output/prompts.py
path_prompt(prompt: str, default: Any = ..., show_default: bool = True, exist_ok: bool = True, must_exist: bool = False, **kwargs: Any) -> Path
Source code in harbor_cli/output/prompts.py
delete_prompt(config: HarborCLIConfig, force: bool, dry_run: bool = False, resource: str | None = None, name: str | None = None) -> None
Prompt user to confirm deletion of a resource.