attempt hotfix
This commit is contained in:
@@ -4,6 +4,7 @@ from pathlib import Path
|
||||
|
||||
import typer
|
||||
from typer._completion_shared import install, _get_shell_name
|
||||
from typer._completion_classes import completion_init
|
||||
from zshell.subcommands import shell, scheme, screenshot, wallpaper, record
|
||||
|
||||
app = typer.Typer(name="zshell-cli", add_completion=False)
|
||||
@@ -39,14 +40,16 @@ def _install_completion() -> None:
|
||||
_, path = install(prog_name="zshell-cli")
|
||||
print(f"zshell-cli: Shell completion installed ({shell}: {path})")
|
||||
print("zshell-cli: Restart your shell or source the file to enable tab-completion.")
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as e:
|
||||
print(f"zshell-cli: Failed to install shell completion: {e}", file=sys.stderr)
|
||||
raise typer.Exit(code=1)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
if "--install-autocomplete" in sys.argv:
|
||||
_install_completion()
|
||||
return
|
||||
completion_init()
|
||||
if sys.stdout.isatty() and not _completion_installed():
|
||||
print("zshell-cli: Tip: run with --install-autocomplete for tab completion.", file=sys.stderr)
|
||||
app()
|
||||
|
||||
@@ -25,7 +25,7 @@ from materialyoucolor.utils.math_utils import (
|
||||
app = typer.Typer()
|
||||
|
||||
|
||||
def _complete_scheme_name(incomplete):
|
||||
def _complete_scheme_name(ctx, incomplete):
|
||||
schemes = [
|
||||
"fruit-salad",
|
||||
"expressive",
|
||||
@@ -40,7 +40,7 @@ def _complete_scheme_name(incomplete):
|
||||
return [s for s in schemes if incomplete in s]
|
||||
|
||||
|
||||
def _complete_preset(incomplete):
|
||||
def _complete_preset(ctx, incomplete):
|
||||
results = []
|
||||
for sid, meta in list_schemes().items():
|
||||
for v in meta.variants:
|
||||
@@ -50,7 +50,7 @@ def _complete_preset(incomplete):
|
||||
return results
|
||||
|
||||
|
||||
def _complete_mode(incomplete):
|
||||
def _complete_mode(ctx, incomplete):
|
||||
return [m for m in ("dark", "light") if incomplete in m]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user