fix(zsh): apply zshellcheck lint fixes

- use [[ ]] over [ ], quote vars, shallow clone in zinit.zsh
- typeset -A instead of declare -A
- nullglob (N) and path array idiom in bin.zsh/default.zsh
This commit is contained in:
Tri Vo Khac committed 2026-06-24 11:13:22 +07:00
1 parent 8f2ece4fb7
commit f62b2b1e4a
3 files changed
+8 -8

No files matched your search

+4 -4
View File
@@ -16,8 +16,8 @@ if [[ ! -f "$MARKER_FILE" ]]; then
for tool in $gnu_tools; do
gnubin="/opt/homebrew/opt/$tool/libexec/gnubin"
if [ -d "$gnubin" ]; then
for bin in "$gnubin"/*; do
if [[ -d "$gnubin" ]]; then
for bin in "$gnubin"/*(N); do
ln -sf "$bin" "$XDG_BIN_HOME/$(basename "$bin")"
done
fi
@@ -33,10 +33,10 @@ local bin_paths=(
"/opt/homebrew/opt/gnu-getopt/bin"
)
for bin_path in "${bin_paths[@]}"; do
if [ -d "$bin_path" ]; then
if [[ -d "$bin_path" ]]; then
case ":$PATH:" in
*":$bin_path:"*) ;;
*) PATH="$bin_path:$PATH" ;;
*) path=("$bin_path" $path) ;;
esac
fi
done
+1 -1
View File
@@ -12,5 +12,5 @@ export STARSHIP_CONFIG="$XDG_CONFIG_HOME"/starship/starship.toml
export PNPM_HOME="$HOME/.local/share/pnpm"
case ":$PATH:" in
*":$PNPM_HOME/bin:"*) ;;
*) export PATH="$PNPM_HOME/bin:$PATH" ;;
*) path=("$PNPM_HOME/bin" $path) ;;
esac
+3 -3
View File
@@ -1,11 +1,11 @@
#!/usr/bin/env zsh
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
[ ! -d $ZINIT_HOME ] && mkdir -p "$(dirname $ZINIT_HOME)"
[ ! -d $ZINIT_HOME/.git ] && git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
[[ ! -d "$ZINIT_HOME" ]] && mkdir -p "$(dirname "$ZINIT_HOME")"
[[ ! -d "$ZINIT_HOME/.git" ]] && git clone --depth 1 https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
# not to use aliases: zi or zini
declare -A ZINIT
typeset -A ZINIT
ZINIT[NO_ALIASES]=1
ZINIT[LIST_COMMAND]='lsd --tree'