click-completion
click-completion copied to clipboard
Feature: Config class for getting installation config without running the installation process
Adds a separate class called InstallConfiguration
which holds the actual configuration for auto completion installation. The reason for this refactoring and feature was to add a way to get the path to the shell config without actually having to run to installation process.
Backwards compatibility is preserved while adding the possibility to install with the configuration class as well through the new function install_from_config(install_config: InstallConfiguration) -> Tuple[str, str]
.
Also added documentation info Return
and Raises
for the install
function.
Example usage with the new class:
import click_completion.core
# Creates an InstallConfiguration class. This takes all parameters that the `install` function takes.
install_config = click_completion.core.InstallConfiguration()
# Run the actual installation process from the InstallConfiguration class
click_completion.core.install_from_config(install_config)
LGTM. I would have put the whole logic into the class, even the install method. And then I would have called that an installer. But in its current state it looks ok anyway.
@glehmann : van you see a reason not to merge this upstream?