fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
b1e681030
master
1# localization: skip(private) 2function __fish_anypython 3if set -l path( command -s python3) 4# Do not consider the stub /usr/bin/python3 that comes installed on Darwin to be Python 5# unless Xcode reports a real directory path. 6and not begin 7string match -q Darwin --"$ ( uname ) " 8and string match -q /usr/bin/python3 --$path 9and type -q xcode-select 10and not xcode-select --print-path&> /dev/null 11end 12echo $path 13return 0 14end 15set -l best_path 16set -l best_minor_version 17set -l minor_version 18for pathin ( path filter -fx --$PATH /python3.*) 19string match -rq --'.*/python3\.(?<minor_version>\d+)$' $path 20and test $minor_version -ge 5 # Python 3.5+ 21or continue 22and begin 23not set -q best_path[ 1 ] 24or test $minor_version -gt $best_minor_version 25end 26set best_path$path 27set best_minor_version$minor_version 28end 29if set -q best_path[ 1 ] 30echo $best_path 31return 0 32end 33# We have no python. 34return 1 35end