mirror of
https://github.com/oh-my-fish/theme-bobthefish.git
synced 2024-10-27 20:34:23 +00:00
[bobthefish] More virtualenv tweaks
* Inline a one-line method that's called one place * Make sure __bobthecow_virtualenv_python_version doesn't fail if python isn't a symlink. * Add a visual segment indicator after python version glyph.
This commit is contained in:
parent
8ac71fb43f
commit
623d162f2b
@ -310,7 +310,8 @@ function __bobthefish_prompt_dir -d 'Display a shortened form of the current dir
|
|||||||
end
|
end
|
||||||
|
|
||||||
function __bobthefish_virtualenv_python_version -d 'Get current python version'
|
function __bobthefish_virtualenv_python_version -d 'Get current python version'
|
||||||
switch (readlink (which python))
|
set -l python_version (readlink (which python))
|
||||||
|
switch "$python_version"
|
||||||
case python2
|
case python2
|
||||||
echo $__bobthefish_superscript_glyph[2]
|
echo $__bobthefish_superscript_glyph[2]
|
||||||
case python3
|
case python3
|
||||||
@ -320,15 +321,16 @@ function __bobthefish_virtualenv_python_version -d 'Get current python version'
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function __bobthefish_virtualenv -d 'Get the current virtualenv'
|
|
||||||
echo $__bobthefish_virtualenv_glyph(__bobthefish_virtualenv_python_version) (basename "$VIRTUAL_ENV")
|
|
||||||
end
|
|
||||||
|
|
||||||
function __bobthefish_prompt_virtualfish -d "Display activated virtual environment (only for virtualfish, virtualenv's activate.fish changes prompt by itself)"
|
function __bobthefish_prompt_virtualfish -d "Display activated virtual environment (only for virtualfish, virtualenv's activate.fish changes prompt by itself)"
|
||||||
set -q VIRTUAL_ENV; or return
|
set -q VIRTUAL_ENV; or return
|
||||||
|
set -l version_glyph (__bobthefish_virtualenv_python_version)
|
||||||
|
if test "$version_glyph"
|
||||||
|
__bobthefish_start_segment $__bobthefish_med_blue $__bobthefish_lt_grey
|
||||||
|
echo -n -s $__bobthefish_virtualenv_glyph $version_glyph
|
||||||
|
end
|
||||||
__bobthefish_start_segment $__bobthefish_med_blue $__bobthefish_lt_grey
|
__bobthefish_start_segment $__bobthefish_med_blue $__bobthefish_lt_grey
|
||||||
set_color $__bobthefish_lt_grey --bold
|
set_color $__bobthefish_lt_grey --bold
|
||||||
echo -n -s (__bobthefish_virtualenv) ' '
|
echo -n -s (basename "$VIRTUAL_ENV") ' '
|
||||||
set_color normal
|
set_color normal
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user