Skip to content

Commit

Permalink
handle error when the list is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
psycoder-sup authored Oct 6, 2024
1 parent 44c521a commit d078800
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions functions/_tide_pwd.fish
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ eval "function _tide_pwd
string match -qr \"(?<trunc>\..|.)\" \$dir_section
set -l glob \$parent_dir/\$trunc*/
set -e glob[(contains -i \$parent_dir/\$dir_section/ \$glob)] # This is faster than inverse string match
set -l indices (contains -i $parent_dir/$dir_section/ $glob)
if set -q indices[1]
set -e glob[$indices]
end
while string match -qr \"^\$parent_dir/\$(string escape --style=regex \$trunc)\" \$glob &&
string match -qr \"(?<trunc>\$(string escape --style=regex \$trunc).)\" \$dir_section
end
Expand Down

0 comments on commit d078800

Please sign in to comment.