mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-08 08:01:15 -03:00
Add __fish_anypython helper function
This just finds the first usable python and echos it, so it can then be used. We have a few places where we use it and I'm about to add some more.
This commit is contained in:
10
share/functions/__fish_anypython.fish
Normal file
10
share/functions/__fish_anypython.fish
Normal file
@@ -0,0 +1,10 @@
|
||||
function __fish_anypython
|
||||
# Try python3 first, because that's usually faster and generally nicer.
|
||||
for py in python3 python2 python
|
||||
command -sq $py
|
||||
and echo $py
|
||||
and return 0
|
||||
end
|
||||
# We have no python.
|
||||
return 1
|
||||
end
|
||||
Reference in New Issue
Block a user