diff --git a/fish/add-on.fish b/fish/add-on.fish index afc4ea1..f366f59 100644 --- a/fish/add-on.fish +++ b/fish/add-on.fish @@ -111,6 +111,12 @@ function ls --description 'alias ls to eza with directory `.tldr` descriptions' return end + # 空目录直接返回:BSD seq(macOS)遇到 `seq 0` 会倒数输出 "1 0", + # 导致下面用 $lines[0] 取值时报 "array indices start at 1" + if test (count $lines) -eq 0 + return + end + # 双路循环渲染 for i in (seq (count $lines)) set -l line $lines[$i]