When autocompletion is created in typer, the necessary changes are made in $HOME/.zshrc:
https://github.com/tiangolo/typer/blob/a93e6b2f86a34fd82741ae837b9b188083a5e9c0/typer/completion.py#L225
However, the path to the directory where the .zshrc file is in, can be set by the environment variable ZDOTDIR. Therefore, typer should check first if the environment variable ZDOTDIR is set and valid and use it to find .zshrc and add the necessary line for auto-completion. If it is invalid or simply not set, the default path to $HOME/.zshrc can be used.
To Reproduce
zsh
mkdir "$HOME/not_default_zsh_dir"
touch "$HOME/not_default_zsh_dir/.zshrc"
export ZDOTDIR="$HOME/not_default_zsh_dir"
# try using the typer autocompletion now, it should fail
Expected behavior
typer should check for the ZDOTDIR env var and use it as base to locate .zshrc instead of always using HOME.
Describe the bug
When autocompletion is created in typer, the necessary changes are made in
$HOME/.zshrc
: https://github.com/tiangolo/typer/blob/a93e6b2f86a34fd82741ae837b9b188083a5e9c0/typer/completion.py#L225 However, the path to the directory where the.zshrc
file is in, can be set by the environment variableZDOTDIR
. Therefore, typer should check first if the environment variableZDOTDIR
is set and valid and use it to find.zshrc
and add the necessary line for auto-completion. If it is invalid or simply not set, the default path to$HOME/.zshrc
can be used.To Reproduce
Expected behavior
typer should check for the
ZDOTDIR
env var and use it as base to locate.zshrc
instead of always usingHOME
.