attempt hotfix

This commit is contained in:
2026-05-28 13:49:34 +02:00
parent ef1bcf6c73
commit fda3712855
2 changed files with 8 additions and 5 deletions
+5 -2
View File
@@ -4,6 +4,7 @@ from pathlib import Path
import typer import typer
from typer._completion_shared import install, _get_shell_name 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 from zshell.subcommands import shell, scheme, screenshot, wallpaper, record
app = typer.Typer(name="zshell-cli", add_completion=False) app = typer.Typer(name="zshell-cli", add_completion=False)
@@ -39,14 +40,16 @@ def _install_completion() -> None:
_, path = install(prog_name="zshell-cli") _, path = install(prog_name="zshell-cli")
print(f"zshell-cli: Shell completion installed ({shell}: {path})") print(f"zshell-cli: Shell completion installed ({shell}: {path})")
print("zshell-cli: Restart your shell or source the file to enable tab-completion.") print("zshell-cli: Restart your shell or source the file to enable tab-completion.")
except Exception: except Exception as e:
pass print(f"zshell-cli: Failed to install shell completion: {e}", file=sys.stderr)
raise typer.Exit(code=1)
def main() -> None: def main() -> None:
if "--install-autocomplete" in sys.argv: if "--install-autocomplete" in sys.argv:
_install_completion() _install_completion()
return return
completion_init()
if sys.stdout.isatty() and not _completion_installed(): if sys.stdout.isatty() and not _completion_installed():
print("zshell-cli: Tip: run with --install-autocomplete for tab completion.", file=sys.stderr) print("zshell-cli: Tip: run with --install-autocomplete for tab completion.", file=sys.stderr)
app() app()
+3 -3
View File
@@ -25,7 +25,7 @@ from materialyoucolor.utils.math_utils import (
app = typer.Typer() app = typer.Typer()
def _complete_scheme_name(incomplete): def _complete_scheme_name(ctx, incomplete):
schemes = [ schemes = [
"fruit-salad", "fruit-salad",
"expressive", "expressive",
@@ -40,7 +40,7 @@ def _complete_scheme_name(incomplete):
return [s for s in schemes if incomplete in s] return [s for s in schemes if incomplete in s]
def _complete_preset(incomplete): def _complete_preset(ctx, incomplete):
results = [] results = []
for sid, meta in list_schemes().items(): for sid, meta in list_schemes().items():
for v in meta.variants: for v in meta.variants:
@@ -50,7 +50,7 @@ def _complete_preset(incomplete):
return results return results
def _complete_mode(incomplete): def _complete_mode(ctx, incomplete):
return [m for m in ("dark", "light") if incomplete in m] return [m for m in ("dark", "light") if incomplete in m]