-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #703 from amal-thundiyil/fix
fix(config): move `--install-tab-completion` to its own command
- Loading branch information
Showing
5 changed files
with
36 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import click | ||
|
||
from kart.completion import Shells, install_tab_completion | ||
from kart.cli_util import add_help_subcommand, KartGroup | ||
|
||
|
||
@add_help_subcommand | ||
@click.group(cls=KartGroup) | ||
@click.pass_context | ||
def install(ctx, **kwargs): | ||
"""Install tools and add-ons""" | ||
|
||
|
||
@install.command() | ||
@click.option( | ||
"--shell", | ||
nargs=1, | ||
type=click.Choice([s.value for s in Shells] + ["auto"]), | ||
default="auto", | ||
help="Select a shell to install tab completion for. Defaults to auto for auto-detecting shell.", | ||
) | ||
def tab_completion(shell: str): | ||
"""Install tab completion for the specific or current shell""" | ||
if shell == "auto": | ||
shell, path = install_tab_completion() | ||
else: | ||
shell, path = install_tab_completion(shell=shell) | ||
click.secho(f"{shell} completion installed in {path}", fg="green") | ||
click.echo("Completion will take effect once you restart the terminal") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters