You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I used the GitHub search to find a similar question and didn't find it.
I searched the Typer documentation, with the integrated search.
I already searched in Google "How to X in Typer" and didn't find any information.
I already read and followed all the tutorials in the docs and didn't find an answer.
I already checked if it is not related to Typer but to Click.
Commit to Help
I commit to help with one of those options 👆
Example Code
N/A
Description
The current implementation of Zsh completion installation adds following lines to .zshrc.
fpath+=~/.zfunc; autoload -Uz compinit; compinit
zstyle ':completion:*' menu select
This has some unintended consequences, especially if user uses a shell framework such as Oh My Zsh.
There is a noticable slowdown in Zsh startup in some configurations, including OMZ.
This happens because OMZ runs compinit and caches it ($ZSH/oh-my-zsh.sh file sourced in .zshrc), then fpath is modified (this invalidates the cache) and compinit runs again, but now takes more time. This problem is not exclusive to OMZ and can happen in other Zsh configurations.
This can probably break some other installed completions (untested) Source 1:
I think doing a second compinit after OMZ is loaded will break non-autoloaded completion definitions.
Many Zsh frameworks & plugin managers include a call to compinit on startup. Calling compinit more than once increases startup time significantly and erases completion functions added programmatically. You might want to make your users aware of this, to save yourself needless bug reports.
zstyle ':completion:*' menu select changes completion style for all CLI programs run from Zsh.
This was actually acknowledged in the comment
# TODO: consider setting the style only for the current program
# style_line = f"zstyle ':completion:*:*:{prog_name}:*' menu select"
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
First Check
Commit to Help
Example Code
Description
The current implementation of Zsh completion installation adds following lines to
.zshrc
.This has some unintended consequences, especially if user uses a shell framework such as Oh My Zsh.
This happens because OMZ runs
compinit
and caches it ($ZSH/oh-my-zsh.sh
file sourced in.zshrc
), thenfpath
is modified (this invalidates the cache) andcompinit
runs again, but now takes more time. This problem is not exclusive to OMZ and can happen in other Zsh configurations.Source 1: Source 2:
zstyle ':completion:*' menu select
changes completion style for all CLI programs run from Zsh.This was actually acknowledged in the comment
Additional Issues with install_zsh Function:
$HOME
as a location of.zshrc
, this is not always true: [BUG] typer doesn't respect ZDOTDIR env var when adding autocompletion for zsh #171 Almost fixed in: Support ZDOTDIR in zsh completion #870.if "zstyle" not in zshrc_content
..zfunc
is not a standard place for zsh completion functions - this clutters home directory..zshrc
can probably be avoided.I’m opening this discussion to request permission to create an issue and contribute fixes.
Operating System
macOS
Operating System Details
No response
Typer Version
0.15.1
Python Version
3.13.1
Additional Context
This bug was found during research for implementation of Zsh completions in duty: pawamoy/duty#34. During discussion there, an idea was born for astral-sh/uv#11354 and pypa/pipx#1604.
Beta Was this translation helpful? Give feedback.
All reactions