harbor_cli.harbor
Attributes
AttrType = TypeVar('AttrType')
module-attribute
Classes
ArtifactNameFormatError
Bases: HarborCLIError
Source code in harbor_cli/exceptions.py
ArtifactName
Bases: NamedTuple
Source code in harbor_cli/harbor/artifact.py
Attributes
domain: str | None
instance-attribute
project: str
instance-attribute
repository: str
instance-attribute
reference: str
instance-attribute
Functions
parse_artifact_name(s: str) -> ArtifactName
Splits an artifact string into domain name (optional), project, repo, and reference (tag or digest).
Raises ValueError if the string is not in the correct format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
s |
str
|
Artifact string in the form of [domain/] |
required |
Returns:
Type | Description |
---|---|
ArtifactName
|
Named tuple of domain name (optional), project, repo, and reference (tag or digest). |
Source code in harbor_cli/harbor/artifact.py
get_artifact_architecture(artifact: Artifact) -> str | None
get_artifact_os(artifact: Artifact) -> str | None
get_artifact_severity(artifact: Artifact) -> str | None
Attempt to get the severity string for an artifact. Not every artifact has a scan overview, and not every scan overview has a severity string.
Source code in harbor_cli/harbor/artifact.py
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
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
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
|