mirror of
https://github.com/oh-my-fish/theme-bobthefish.git
synced 2024-10-27 20:34:23 +00:00
Update loop for finding go.mod
Also had to move `set -l real_pwd (__bobthefish_pwd)` above the prompts so that `$real_pwd` is available inside the prompt function
This commit is contained in:
parent
fffbde266f
commit
92a2e46734
@ -853,16 +853,13 @@ function __bobthefish_prompt_golang -S -d 'Display current Go information'
|
|||||||
[ "$theme_display_go" = 'no' ]
|
[ "$theme_display_go" = 'no' ]
|
||||||
and return
|
and return
|
||||||
|
|
||||||
|
|
||||||
set -l dir $real_pwd
|
|
||||||
set -l found_gomod 0
|
|
||||||
set -l gomod_version "0"
|
|
||||||
set -l gomod_file
|
|
||||||
|
|
||||||
# find the closest go.mod
|
# find the closest go.mod
|
||||||
|
set -l gomod_version "0"
|
||||||
|
set -l d $real_pwd
|
||||||
while not [ -z "$d" ]
|
while not [ -z "$d" ]
|
||||||
if [ -e $d/go.mod ]
|
if [ -e $d/go.mod ]
|
||||||
grep "^go\ " "$gomod_file" | read __ gomod_version
|
grep "^go\ " "$d/go.mod" | read __ gomod_version
|
||||||
|
break
|
||||||
end
|
end
|
||||||
|
|
||||||
[ "$d" = "/" ]
|
[ "$d" = "/" ]
|
||||||
@ -870,7 +867,7 @@ function __bobthefish_prompt_golang -S -d 'Display current Go information'
|
|||||||
end
|
end
|
||||||
|
|
||||||
# no go.mod, not in a go project, don't display the prompt
|
# no go.mod, not in a go project, don't display the prompt
|
||||||
if test "$found_gomod" -eq "0"
|
if [ "$gomod_version" = "0" ]
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1230,6 +1227,8 @@ function fish_prompt -d 'bobthefish, a fish theme optimized for awesome'
|
|||||||
# Start each line with a blank slate
|
# Start each line with a blank slate
|
||||||
set -l __bobthefish_current_bg
|
set -l __bobthefish_current_bg
|
||||||
|
|
||||||
|
set -l real_pwd (__bobthefish_pwd)
|
||||||
|
|
||||||
# Status flags and input mode
|
# Status flags and input mode
|
||||||
__bobthefish_prompt_status $last_status
|
__bobthefish_prompt_status $last_status
|
||||||
|
|
||||||
@ -1253,7 +1252,6 @@ function fish_prompt -d 'bobthefish, a fish theme optimized for awesome'
|
|||||||
__bobthefish_prompt_virtualgo
|
__bobthefish_prompt_virtualgo
|
||||||
__bobthefish_prompt_node
|
__bobthefish_prompt_node
|
||||||
|
|
||||||
set -l real_pwd (__bobthefish_pwd)
|
|
||||||
|
|
||||||
# VCS
|
# VCS
|
||||||
set -l git_root_dir (__bobthefish_git_project_dir $real_pwd)
|
set -l git_root_dir (__bobthefish_git_project_dir $real_pwd)
|
||||||
|
Loading…
Reference in New Issue
Block a user