mirror of
https://github.com/oh-my-fish/theme-bobthefish.git
synced 2024-10-27 20:34:23 +00:00
More logic fixing
This commit is contained in:
parent
4b3197d1b0
commit
1663a155f8
@ -868,40 +868,40 @@ function __bobthefish_prompt_golang -S -d 'Display current Go information'
|
|||||||
echo "$asdf_go_sdk_version" | read _asdf_plugin asdf_go_version asdf_provenance
|
echo "$asdf_go_sdk_version" | read _asdf_plugin asdf_go_version asdf_provenance
|
||||||
end
|
end
|
||||||
|
|
||||||
[ (string trim -- "$asdf_provenance") = "$HOME/.tool-versions" ]
|
|
||||||
and return
|
|
||||||
|
|
||||||
set go_version $asdf_go_version
|
set go_version $asdf_go_version
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
set -l cwd (pwd)
|
||||||
|
set -l dir (pwd)
|
||||||
|
set -l found_gomod 0
|
||||||
set -l no_go_installed 0
|
set -l no_go_installed 0
|
||||||
set -l gomod_version "0"
|
set -l gomod_version "0"
|
||||||
|
set -l gomod_file
|
||||||
# no version from asdf, check go.mod file
|
|
||||||
if [ -z "$go_version" ]
|
|
||||||
set -l cwd (pwd)
|
|
||||||
set -l dir (pwd)
|
|
||||||
set -l gomod_file
|
|
||||||
set -l _gomod
|
|
||||||
set -l found_gomod 0
|
|
||||||
|
|
||||||
# find the closest go.mod
|
# find the closest go.mod
|
||||||
while not test "$dir" = "/"
|
while not test "$dir" = "/"
|
||||||
set gomod_file "$dir/go.mod"
|
set gomod_file "$dir/go.mod"
|
||||||
|
|
||||||
if test -f "$gomod_file"
|
if test -f "$gomod_file"
|
||||||
cat "$gomod_file" | grep "^go\ " | read _gomod gomod_version
|
set found_gomod 1
|
||||||
break
|
cat "$gomod_file" | grep "^go\ " | read _gomod gomod_version
|
||||||
end
|
break
|
||||||
|
|
||||||
cd $dir/..
|
|
||||||
set dir (pwd)
|
|
||||||
end
|
end
|
||||||
cd $cwd
|
|
||||||
|
|
||||||
|
cd $dir/..
|
||||||
|
set dir (pwd)
|
||||||
|
end
|
||||||
|
cd $cwd
|
||||||
|
|
||||||
|
if [ -z "$go_version" ]
|
||||||
set go_version $gomod_version
|
set go_version $gomod_version
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if test "$found_gomod" -eq "0"
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
set -l actual_go_version "0"
|
set -l actual_go_version "0"
|
||||||
if ! type -fq go
|
if ! type -fq go
|
||||||
set no_go_installed 1
|
set no_go_installed 1
|
||||||
|
Loading…
Reference in New Issue
Block a user