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:
1 parent
8f2ece4fb7
commit
f62b2b1e4a
3 files changed
+8
-8
No files matched your search
@@ -16,8 +16,8 @@ if [[ ! -f "$MARKER_FILE" ]]; then
|
|||||||
|
|
||||||
for tool in $gnu_tools; do
|
for tool in $gnu_tools; do
|
||||||
gnubin="/opt/homebrew/opt/$tool/libexec/gnubin"
|
gnubin="/opt/homebrew/opt/$tool/libexec/gnubin"
|
||||||
if [ -d "$gnubin" ]; then
|
if [[ -d "$gnubin" ]]; then
|
||||||
for bin in "$gnubin"/*; do
|
for bin in "$gnubin"/*(N); do
|
||||||
ln -sf "$bin" "$XDG_BIN_HOME/$(basename "$bin")"
|
ln -sf "$bin" "$XDG_BIN_HOME/$(basename "$bin")"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
@@ -33,10 +33,10 @@ local bin_paths=(
|
|||||||
"/opt/homebrew/opt/gnu-getopt/bin"
|
"/opt/homebrew/opt/gnu-getopt/bin"
|
||||||
)
|
)
|
||||||
for bin_path in "${bin_paths[@]}"; do
|
for bin_path in "${bin_paths[@]}"; do
|
||||||
if [ -d "$bin_path" ]; then
|
if [[ -d "$bin_path" ]]; then
|
||||||
case ":$PATH:" in
|
case ":$PATH:" in
|
||||||
*":$bin_path:"*) ;;
|
*":$bin_path:"*) ;;
|
||||||
*) PATH="$bin_path:$PATH" ;;
|
*) path=("$bin_path" $path) ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -12,5 +12,5 @@ export STARSHIP_CONFIG="$XDG_CONFIG_HOME"/starship/starship.toml
|
|||||||
export PNPM_HOME="$HOME/.local/share/pnpm"
|
export PNPM_HOME="$HOME/.local/share/pnpm"
|
||||||
case ":$PATH:" in
|
case ":$PATH:" in
|
||||||
*":$PNPM_HOME/bin:"*) ;;
|
*":$PNPM_HOME/bin:"*) ;;
|
||||||
*) export PATH="$PNPM_HOME/bin:$PATH" ;;
|
*) path=("$PNPM_HOME/bin" $path) ;;
|
||||||
esac
|
esac
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
|
ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git"
|
||||||
[ ! -d $ZINIT_HOME ] && mkdir -p "$(dirname $ZINIT_HOME)"
|
[[ ! -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/.git" ]] && git clone --depth 1 https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME"
|
||||||
|
|
||||||
# not to use aliases: zi or zini
|
# not to use aliases: zi or zini
|
||||||
declare -A ZINIT
|
typeset -A ZINIT
|
||||||
ZINIT[NO_ALIASES]=1
|
ZINIT[NO_ALIASES]=1
|
||||||
ZINIT[LIST_COMMAND]='lsd --tree'
|
ZINIT[LIST_COMMAND]='lsd --tree'
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user