mirror of
https://github.com/oh-my-fish/theme-bobthefish.git
synced 2025-06-13 13:03:54 +00:00
Fix find_file_up to accept multiple args
This commit is contained in:
parent
ca9e78068a
commit
cee1edb460
@ -895,17 +895,19 @@ function __bobthefish_prompt_desk -S -d 'Display current desk environment'
|
|||||||
set_color normal
|
set_color normal
|
||||||
end
|
end
|
||||||
|
|
||||||
function __bobthefish_prompt_find_file_up_re -S -d 'Find file(s) (as a regex), going up the parent directories'
|
function __bobthefish_prompt_find_file_up -S -d 'Find file(s), going up the parent directories'
|
||||||
set -l dir "$argv[1]"
|
set -l dir "$argv[1]"
|
||||||
set -l file "$argv[2]"
|
set -l files $argv[2..]
|
||||||
|
|
||||||
if [ -z "$dir" ]
|
if [ -z "$dir" ]
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|
||||||
while [ "$dir" ]
|
while [ "$dir" ]
|
||||||
if string match -q -r "$dir/($file)\$" -- $dir/*
|
for f in $files
|
||||||
return
|
if [ -e "$dir/$f" ]
|
||||||
|
return
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
set dir (__bobthefish_dirname "$dir")
|
set dir (__bobthefish_dirname "$dir")
|
||||||
@ -919,7 +921,7 @@ function __bobthefish_prompt_node -S -d 'Display current node version'
|
|||||||
if [ "$theme_display_node" = 'always' -o "$theme_display_nvm" = 'yes' ]
|
if [ "$theme_display_node" = 'always' -o "$theme_display_nvm" = 'yes' ]
|
||||||
set should_show 1
|
set should_show 1
|
||||||
else if [ "$theme_display_node" = 'yes' ]
|
else if [ "$theme_display_node" = 'yes' ]
|
||||||
__bobthefish_prompt_find_file_up_re "$PWD" '\.nvmrc|\.node-version|package\.json'
|
__bobthefish_prompt_find_file_up "$PWD" package.json .nvmrc .node-version
|
||||||
and set should_show 1
|
and set should_show 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user