Skip to content

Commit d8e0c9a

Browse files
auge2uclaude
andcommitted
Fix ShellCheck warnings
- Quote variables to prevent word splitting (SC2086) - Check exit code directly instead of using $? (SC2181) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 6ca804c commit d8e0c9a

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

nerd-font-manager.sh

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ cli_mode() {
128128

129129
# Add [ALL] option and enable search with header hint
130130
local SELECTED
131-
SELECTED=$(printf "[ALL] Install all fonts\n%s\n" $FONTS | fzf --multi --prompt="Install (type to filter) > " --header="Select fonts (TAB to multi-select, ENTER to confirm)")
131+
SELECTED=$(echo -e "[ALL] Install all fonts\n$FONTS" | fzf --multi --prompt="Install (type to filter) > " --header="Select fonts (TAB to multi-select, ENTER to confirm)")
132132

133133
if [ -z "$SELECTED" ]; then
134134
echo "Nothing selected."
@@ -140,7 +140,7 @@ cli_mode() {
140140
echo "Installing ALL available Nerd Fonts..."
141141
mapfile -t names <<< "$FONTS"
142142
else
143-
mapfile -t names <<< "$(printf "%s\n" $SELECTED)"
143+
mapfile -t names <<< "$SELECTED"
144144
fi
145145
install_fonts_by_middle_names "${names[@]}"
146146
;;
@@ -156,7 +156,7 @@ cli_mode() {
156156

157157
# Add [ALL] option and enable search with header hint
158158
local SELECTED
159-
SELECTED=$(printf "[ALL] Uninstall all fonts\n%s\n" $FONTS | fzf --multi --prompt="Uninstall (type to filter) > " --header="Select fonts (TAB to multi-select, ENTER to confirm)")
159+
SELECTED=$(echo -e "[ALL] Uninstall all fonts\n$FONTS" | fzf --multi --prompt="Uninstall (type to filter) > " --header="Select fonts (TAB to multi-select, ENTER to confirm)")
160160

161161
if [ -z "$SELECTED" ]; then
162162
echo "Nothing selected."
@@ -168,7 +168,7 @@ cli_mode() {
168168
echo "Uninstalling ALL installed Nerd Fonts..."
169169
mapfile -t names <<< "$FONTS"
170170
else
171-
mapfile -t names <<< "$(printf "%s\n" $SELECTED)"
171+
mapfile -t names <<< "$SELECTED"
172172
fi
173173
uninstall_fonts_by_middle_names "${names[@]}"
174174
;;
@@ -220,12 +220,11 @@ gui_mode() {
220220

221221
# Optional search filter
222222
local SEARCH
223-
SEARCH=$(osascript <<EOF
223+
if ! SEARCH=$(osascript <<EOF
224224
display dialog "Enter search term (leave empty for all fonts):" default answer "" with title "Filter Fonts" buttons {"Cancel", "Search"} default button "Search"
225225
text returned of result
226226
EOF
227-
)
228-
if [ $? -ne 0 ]; then
227+
); then
229228
exit 0
230229
fi
231230

@@ -276,12 +275,11 @@ EOF
276275

277276
# Optional search filter
278277
local SEARCH
279-
SEARCH=$(osascript <<EOF
278+
if ! SEARCH=$(osascript <<EOF
280279
display dialog "Enter search term (leave empty for all fonts):" default answer "" with title "Filter Fonts" buttons {"Cancel", "Search"} default button "Search"
281280
text returned of result
282281
EOF
283-
)
284-
if [ $? -ne 0 ]; then
282+
); then
285283
exit 0
286284
fi
287285

0 commit comments

Comments
 (0)