click_config
A configuration option for click.
Classes¶
ConfigOption
¶
ConfigOption(
param_decls: Optional[StrSequence] = None,
show_default: Optional[BoolOrStr] = None,
allow_from_autoenv: bool = True,
help: Optional[str] = None,
show_envvar: bool = False,
**attrs
)
Functions¶
config_option
¶
config_option(
*param_decls: str,
cls: Optional[Type[ConfigOption]] = None,
**attrs: Any
) -> Callable[[FC], FC]
Attaches a ConfigOption to the command.
All positional arguments are passed as parameter declarations to ConfigOption.
All keyword arguments are forwarded unchanged (except cls). This is equivalent to creating a
ConfigOption instance manually and attaching it to the Command.params list.
For the default option class, refer to ConfigOption and Parameter for descriptions of parameters.
Parameters:
*param_decls-
Passed as positional arguments to the constructor of
cls.TYPE:
strDEFAULT:
() cls-
the option class to instantiate. This defaults to
ConfigOption.TYPE:
Optional[Type[ConfigOption]]DEFAULT:
None **attrs-
Passed as keyword arguments to the constructor of
cls.TYPE:
AnyDEFAULT:
{}
Returns:
-
Callable[[FC], FC] -
A decorated function.
download_url
¶
download_url(url: str) -> Path
Download the contents of a URL.
Parameters:
url-
The URL to download
TYPE:
str
Returns:
-
Path -
The Path to the downloaded file.
Raises:
-
BadInputError -
if there is a problem downloading the URL
get_file_name_from_url
¶
get_file_name_from_url(url: str) -> str
resolve_conf_location
¶
resolve_conf_location(url_or_path: str) -> Path
Resolve a URL or path.
The path is considered a URL if it is parseable as such and starts with http:// or https://.
Parameters:
url_or_path-
The URL or path to resolve.
TYPE:
str
Raises:
-
BumpVersionError -
if the file does not exist.
Returns:
-
Path -
The contents of the location.