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
One of the annoyances I've always had with rupa/z is that if you set _Z_DATA to an XDG compliant location (#20), you have to make sure the directory exists with something like this:
_Z_DATA=${XDG_DATA_HOME:=$HOME/.local/share}/z/data
if [[ !-f$_Z_DATA ]];then
mkdir -p ${_Z_DATA:h}
touch $_Z_DATAfi
I tried zsh-z and it suffers from the same issue:
ZSHZ_DATA=${XDG_DATA_HOME:=$HOME/.local/share}/zsh-z/data
# error: zshz:28: no such file or directory: ~/.local/share/zsh-z/data
If a user sets the path they want to use for the z database, zsh-z should create it for them. Would you accept a PR that changes this line...
Any valid value for ZSHZ_DATA or _Z_DATA should include an explicit directory location.
Let's not make any assumptions about what the user meant, but rather issue an error message when appropriate.
Instead of what you have in your second commit, we could do something like the following: right before we assign datafile, we could have
# If the user has configured a custom datafile, make sure its directory is
# specified
if [[ -n ${ZSHZ_DATA:-${_Z_DATA}} && ${ZSHZ_DATA:-${_Z_DATA}} != */* ]]; then
print "Zsh-z: You have configured a custom datafile (${ZSHZ_DATA:-${_Z_DATA}}), but you have not specified its directory."
return
fi
Let me know what you think. And thanks for your patience.
I like it. I just pushed a new commit. I tweaked it just a tiny bit, so let me know if you were expecting something closer to your original ask or if this is acceptable.
One of the annoyances I've always had with rupa/z is that if you set
_Z_DATA
to an XDG compliant location (#20), you have to make sure the directory exists with something like this:I tried zsh-z and it suffers from the same issue:
If a user sets the path they want to use for the z database, zsh-z should create it for them. Would you accept a PR that changes this line...
zsh-z/zsh-z.plugin.zsh
Line 164 in 82f5088
...to this?
The text was updated successfully, but these errors were encountered: