Open hoshsadiq opened 2 years ago
Have a few clarifying questions..
Have you tried using the z-a-bin-gem-node annex?
If you haven't, I feel that it is for this exact situation.
If you have, could you elaborate on your usecase a bit more? I'm not grokking the crux of the issue.
Why can't you update the path and prepend after zinit starts? Or maybe use zinit-continuums/null
and run it last via a wait
ice?
I have not tried z-a-bin-gem-node
, and although I can sympathise with having too many directories in my path because of zinit, I'm not entirely sure creating functions is good enough for me. Many of my binaries need to be accessible outside the shell through executed programs, which will not work with functions. Perhaps the shims will work, but again, seems unnecessary when all that needs to be done is ensure items are appended to the $PATH
instead of prepended.
Why can't you update the path and prepend after zinit starts? Or maybe use
zinit-continuums/null
and run it last via await
ice?
Updating the paths after zinit starts won't work because of the wait
, but using null
and the wait
ice might work, I'll have to try it. The only issue I see with that is that it's unclear what the order of the wait is so I'm not sure.
I guess outside all of that, I still think the default should be to add the paths at the end as opposed to at the beginning. Would it be possible to make this an option?
Can you expand on your use case with a real || hypothetical example?
There is something similar already.
Go here and scroll up to the 2nd to the last item in the table.
fpath is not PATH. fpath is only used by zinit, not other applications.
For example, I'm using saml2aws, and some other tooling uses it too with a specific set of arguments, but I can't make changes to those arguments. I'd like to overload it and pass in custom additional arguments. This would allow those tools to run my script, which then runs the real saml2aws with the arguments my script would change.
fpath is not PATH. fpath is only used by zinit, not other applications.
Not sure that's true, but I could be wrong.
That being said, I agree with you, zinit should not touch $PATH
or allow opt out.
@hoshsadiq
The assertion fpath
is exclusive to zinit
is incorrect. It is used by Ksh and Zsh.
I guess I was talking in the context of zsh and running commands that run other commands that aren't shells. The issue is that when programs attempts to run a command or script, they usually only look in $PATH
. To have it listen to fpath
, you'd need to a) export fpath
(which usually doesn't happen), and the programs would need to invoke the sub command (or script) using zsh or ksh.
This was previously raised already, and so below is just a copy/paste from issueexplorer:
Is your feature request related to a problem? Please describe. When the PATH variable is updated by zinit, items are added at the beginning, which isn't ideal in many scenarios. For me for example, I've added a directory at the start of my PATH so that I can wrap overload some binaries to do custom stuff. Because of zinit I'm unable to do so.
Describe the solution you'd like Ideally we should be able to force zinit to always update PATH by adding the new directories at the end of the $PATH.
Describe alternatives you've considered I haven't. I don't see any other way.