Skip to content

Commit

Permalink
cli: improve docstring for get_build_provider_flags (#4025)
Browse files Browse the repository at this point in the history
Signed-off-by: Callahan Kovacs <callahan.kovacs@canonical.com>
  • Loading branch information
mr-cal authored Jan 30, 2023
1 parent be005b9 commit 569a316
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions snapcraft_legacy/cli/_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,20 @@ def _param_decls_to_kwarg(key: str) -> str:


def get_build_provider_flags(build_provider: str, **kwargs) -> Dict[str, str]:
"""Get configured options applicable to build_provider."""
"""Get provider options from kwargs for a build provider.
build_provider_flags: Dict[str, str] = dict()
Boolean options that are false are not collected from kwargs.
Options without an environment variable are not collected from kwargs.
:param build_provider: Build provider to collect options for. Valid providers are
'host', 'lxd', 'multipass', and 'managed-host'.
:param kwargs: Dictionary containing provider options.
:return: Dictionary of provider options with their environment variable as the key.
:raises RuntimeError: If build provider is invalid.
"""
build_provider_flags: Dict[str, str] = {}

# Should not happen - developer safety check.
if build_provider not in _ALL_PROVIDERS:
Expand Down

0 comments on commit 569a316

Please sign in to comment.