-
Notifications
You must be signed in to change notification settings - Fork 510
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
Add function to check if a command is in path #2489
Comments
The generic functionality you're requesting sounds covered by #2109 For your specific case, would something like this work? -
|
Ah yes good find, missed it when I searched 👍
For this example yes, but not for my usecase: I'm using Nix, so binary install path is symlinked a bunch of times to different places and one of those is actually in PATH (not the parent dir of just executable) Thanks I'll close this and follow progress on #2109 |
You can also do: just := if `which just || echo ''` == '' {
just_executable()
} else {
'just'
} We have unstable just := `which just || true` && 'just' || just_executable() Which is shorter and more inscrutable. But I do like inscrutable things. |
Thanks 👍 |
Here is my usecase:
Let's say just is installed at
/not/in/path/just
.I want my receipes to call other receipe and not care whether just is in path or not, so I use:
I want to show the executed line in
foo
(so I don't prepend a@
to{{ ...
).So calling
/not/in/path/just foo
would output something like:👉 BUT when
just
is in actually in $PATH I'd like instead to show:I was thinking about making a just variable at the top that checks whether just in in $PATH and put
just
if it is, orjust_executable()
otherwise.Hence why I'd like a way to check if just is in $PATH.
Or is there another way to do this?
The text was updated successfully, but these errors were encountered: