hotfix zshell-cli autocompletion failing #108

Merged
zach merged 5 commits from hotfix-zshell-autocompletion into main 2026-05-28 23:24:17 +02:00
Collaborator

Autocompletion is currently broken. This PR aims to resolve the issue.

Calling completion_init() only when _ZSHELL_CLI_COMPLETE env variable is set. Without completion_init(), even when autocomplete was installed, the shell would return Shell zsh not supported..

Autocompletion is currently broken. This PR aims to resolve the issue. Calling `completion_init()` only when `_ZSHELL_CLI_COMPLETE` env variable is set. Without `completion_init()`, even when autocomplete was installed, the shell would return `Shell zsh not supported.`.
AramJonghu added the bug label 2026-05-28 14:26:00 +02:00
AramJonghu self-assigned this 2026-05-28 14:26:00 +02:00
AramJonghu added 3 commits 2026-05-28 14:26:00 +02:00
ctx is unused
Lint & Format (JS/TS) / lint-format (pull_request) Successful in 13s
Python / lint-format (pull_request) Successful in 19s
Python / test (pull_request) Successful in 47s
Lint & Format (Rust) / lint-format (pull_request) Successful in 1m46s
e9aa8268be
AramJonghu requested review from zach 2026-05-28 14:26:00 +02:00
zach added 1 commit 2026-05-28 16:55:43 +02:00
Merge branch 'main' into hotfix-zshell-autocompletion
Lint & Format (JS/TS) / lint-format (pull_request) Successful in 11s
Python / lint-format (pull_request) Successful in 18s
Python / test (pull_request) Successful in 1m20s
Lint & Format (Rust) / lint-format (pull_request) Successful in 1m57s
494653e029
zach requested changes 2026-05-28 17:04:13 +02:00
Dismissed
zach left a comment
Owner

Completions now work as intended.

However, running zshell-cli --install-autocomplete when autocompletion is already installed raises a click.exceptions.Exit:

zshell-cli: Shell completion already installed.
Traceback (most recent call last):
  File "/usr/bin/zshell-cli", line 8, in <module>
    sys.exit(main())
             ~~~~^^
  File "/usr/lib/python3.14/site-packages/zshell/__init__.py", line 51, in main
    _install_completion()
    ~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.14/site-packages/zshell/__init__.py", line 35, in _install_completion
    raise typer.Exit()
click.exceptions.Exit

Maybe we should hide this since it isn't very informative and can cause confusion.

Completions now work as intended. However, running `zshell-cli --install-autocomplete` when autocompletion is already installed raises a `click.exceptions.Exit`: ``` zshell-cli: Shell completion already installed. Traceback (most recent call last): File "/usr/bin/zshell-cli", line 8, in <module> sys.exit(main()) ~~~~^^ File "/usr/lib/python3.14/site-packages/zshell/__init__.py", line 51, in main _install_completion() ~~~~~~~~~~~~~~~~~~~^^ File "/usr/lib/python3.14/site-packages/zshell/__init__.py", line 35, in _install_completion raise typer.Exit() click.exceptions.Exit ``` Maybe we should hide this since it isn't very informative and can cause confusion.
AramJonghu added 1 commit 2026-05-28 22:43:29 +02:00
removed exception in favor of sys.exit() to exit silently with print
Lint & Format (JS/TS) / lint-format (pull_request) Successful in 12s
Python / lint-format (pull_request) Successful in 20s
Python / test (pull_request) Successful in 44s
Lint & Format (Rust) / lint-format (pull_request) Successful in 1m46s
52be099914
Author
Collaborator

Resolved now. It returns a simple print.

zshell-cli --install-autocomplete
zshell-cli: Shell completion already installed.
Resolved now. It returns a simple print. ``` zshell-cli --install-autocomplete zshell-cli: Shell completion already installed. ```
AramJonghu requested review from zach 2026-05-28 22:47:44 +02:00
zach approved these changes 2026-05-28 23:24:13 +02:00
zach merged commit 428809fee8 into main 2026-05-28 23:24:17 +02:00
AramJonghu deleted branch hotfix-zshell-autocompletion 2026-05-28 23:26:37 +02:00
Sign in to join this conversation.