style(skills): use test instead of [ ] in POSIX shell examples

This commit is contained in:
AJ ONeal
2026-03-12 02:55:54 -06:00
parent 734455a6c5
commit 80fc00de21
2 changed files with 9 additions and 9 deletions

View File

@@ -182,24 +182,24 @@ pkg_install() {
chmod a+x "$pkg_src_cmd"
# completions (install what exists — not all builds include them)
if [ -e ./tool-*/completions/tool.bash ]; then
if test -e ./tool-*/completions/tool.bash; then
mkdir -p "$pkg_src_dir/share/bash-completion/completions"
mv ./tool-*/completions/tool.bash \
"$pkg_src_dir/share/bash-completion/completions/tool"
fi
if [ -e ./tool-*/completions/tool.fish ]; then
if test -e ./tool-*/completions/tool.fish; then
mkdir -p "$pkg_src_dir/share/fish/vendor_completions.d"
mv ./tool-*/completions/tool.fish \
"$pkg_src_dir/share/fish/vendor_completions.d/tool.fish"
fi
if [ -e ./tool-*'/completions/_tool' ]; then
if test -e './tool-*/completions/_tool'; then
mkdir -p "$pkg_src_dir/share/zsh/site-functions"
mv './tool-*/completions/_tool' \
"$pkg_src_dir/share/zsh/site-functions/_tool"
fi
# man page
if [ -e ./tool-*/tool.1 ]; then
if test -e ./tool-*/tool.1; then
mkdir -p "$pkg_src_dir/share/man/man1"
mv ./tool-*/tool.1 "$pkg_src_dir/share/man/man1/tool.1"
fi

View File

@@ -129,25 +129,25 @@ pkg_install() {
chmod a+x "$pkg_src_cmd"
# bash completion
if [ -e ./ripgrep-*/complete/rg.bash ]; then
if test -e ./ripgrep-*/complete/rg.bash; then
mkdir -p "$pkg_src_dir/share/bash-completion/completions"
mv ./ripgrep-*/complete/rg.bash \
"$pkg_src_dir/share/bash-completion/completions/rg"
fi
# fish completion
if [ -e ./ripgrep-*/complete/rg.fish ]; then
if test -e ./ripgrep-*/complete/rg.fish; then
mkdir -p "$pkg_src_dir/share/fish/vendor_completions.d"
mv ./ripgrep-*/complete/rg.fish \
"$pkg_src_dir/share/fish/vendor_completions.d/rg.fish"
fi
# zsh completion
if [ -e './ripgrep-*/complete/_rg' ]; then
if test -e './ripgrep-*/complete/_rg'; then
mkdir -p "$pkg_src_dir/share/zsh/site-functions"
mv './ripgrep-*/complete/_rg' \
"$pkg_src_dir/share/zsh/site-functions/_rg"
fi
# man page
if [ -e ./ripgrep-*/doc/rg.1 ]; then
if test -e ./ripgrep-*/doc/rg.1; then
mkdir -p "$pkg_src_dir/share/man/man1"
mv ./ripgrep-*/doc/rg.1 "$pkg_src_dir/share/man/man1/rg.1"
fi
@@ -159,7 +159,7 @@ pkg_get_current_version() {
```
**Note**: Completion paths in completions/man install are best-effort
— use `if [ -e ... ]` guards so the script still works on older releases
— use `if test -e ...` guards so the script still works on older releases
that didn't include them.
---