mirror of
https://github.com/oh-my-fish/theme-bobthefish.git
synced 2025-06-13 13:03:54 +00:00
handle missing generic Python binary ("python") gracefully
This commit is contained in:
parent
12b829e0bf
commit
4cc7582359
@ -847,7 +847,19 @@ function __bobthefish_prompt_rubies -S -d 'Display current Ruby information'
|
|||||||
end
|
end
|
||||||
|
|
||||||
function __bobthefish_virtualenv_python_version -S -d 'Get current Python version'
|
function __bobthefish_virtualenv_python_version -S -d 'Get current Python version'
|
||||||
switch (python --version 2>&1 | tr '\n' ' ')
|
set -l python_version
|
||||||
|
|
||||||
|
# try preferred Python version first
|
||||||
|
if [ (which python) ]
|
||||||
|
set python_version (python --version 2>&1 | tr '\n' ' ')
|
||||||
|
# choose Python 3 over Python 2
|
||||||
|
else if [ (which python3) ]
|
||||||
|
set python_version (python3 --version 2>&1 | tr '\n' ' ')
|
||||||
|
else
|
||||||
|
set python_version (python2 --version 2>&1 | tr '\n' ' ')
|
||||||
|
end
|
||||||
|
|
||||||
|
switch $python_version
|
||||||
case 'Python 2*PyPy*'
|
case 'Python 2*PyPy*'
|
||||||
echo $pypy_glyph
|
echo $pypy_glyph
|
||||||
case 'Python 3*PyPy*'
|
case 'Python 3*PyPy*'
|
||||||
|
Loading…
Reference in New Issue
Block a user