-
-
Notifications
You must be signed in to change notification settings - Fork 664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support ZDOTDIR in zsh completion #870
base: master
Are you sure you want to change the base?
Conversation
f6aff9e
to
6a40926
Compare
zsh supports placing its startup files in a directory other than $HOME, [when the user specifies $ZDOTDIR in ~/.zshenv](https://zsh.sourceforge.io/Intro/intro_3.html). typer currently always writes to `~/.zshrc` and `~/.zfunc`. This means that for users that have $ZDOTDIR set to something other than $HOME, `typer --install-completion` has no effect. Update `install_zsh` to install completion to `$ZDOTDIR/.zshrc` and `$ZDOTDIR/.zfunc/` when set.
6a40926
to
7cbb4a3
Compare
Hmm, it looks like the absolute |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thanks for the PR!
I believe there are ways to use zsh
on Windows with Git Bash
, though I have no experience with it myself. Either way, the test was working before so it feels like we should be able to get this simple check working on Windows as well.
I double checked on a Windows system to see what was going on, and it seems like the subprocess.run
call isn't actually executed properly. The content of new_text
is still echo "custom .zshrc"
when the assert fails. So I don't think the issue is with fpath
.
result.stderr
contains the following:
Fatal Python error: _Py_HashRandomization_Init: failed to get random numbers to initialize Python
Which seems to point at an issue with the runtime environment, probably due to the way how you've used mock.patch.dict
to make changes to os.environ
. Can you think of a different way to run this check?
[UPDATE]: I can indeed use zsh
on Windows with Git Bash
, so I do think this is a meaningful regression.
zsh supports placing its startup files in a directory other than $HOME, when the user specifies $ZDOTDIR in ~/.zshenv.
typer currently always writes to
~/.zshrc
and~/.zfunc
. This means that for users that have $ZDOTDIR set to something other than $HOME,typer --install-completion
has no functional effect on the user's shell.Update
install_zsh
to install completion to$ZDOTDIR/.zshrc
and$ZDOTDIR/.zfunc/
when set.