Assorted shell and Python scripts

Refactor

Changed files
+7 -7
+2 -2
gumssh
···
hostn=$(echo "$line" | awk '{ print $2 }')
hostn_array+=("$hostn")
fi
-
done < "${SSH_CONFIG}"
# Print each member of logins array on a new line and pipe to gum choose.
# Store selection.
selection=$(printf "%s\n" "${hostn_array[@]}" | gum choose --header="SSH Host" --limit=1)
# If $selection is not aborted by user, pass it to the `autossh -M 0` command.
-
if [ "${selection}" != "user aborted" ]; then
autossh -M 0 "${selection}"
fi
···
hostn=$(echo "$line" | awk '{ print $2 }')
hostn_array+=("$hostn")
fi
+
done <"${SSH_CONFIG}"
# Print each member of logins array on a new line and pipe to gum choose.
# Store selection.
selection=$(printf "%s\n" "${hostn_array[@]}" | gum choose --header="SSH Host" --limit=1)
# If $selection is not aborted by user, pass it to the `autossh -M 0` command.
+
if [ -n "${selection}" ]; then
autossh -M 0 "${selection}"
fi
+5 -5
nerdfont_installer
···
# Print the `nf_array` line by line and pipe to `gum choose --no-limit`.
# Create `selection` array from the output of `gum choose --no-limit`.
# It will contain only the items that were selected by the user.
-
selection=($(printf "%s\n" "${nf_array[@]}" | gum choose --no-limit))
# Prompt for user confirmation and proceed with installation of nerd fonts.
#
···
# Clean up local font directory. Removes everything besides fonts.
if ! gum spin --spinner dot --title "Cleaning up local font directory..." \
-- find "${LOCAL_FONT_DIR}" -mindepth 1 \
-
-not -name "*.otf" \
-
-not -name "*.ttf" \
-
-not -name "static" \
-
-exec rm -rf {} \; ; then
gum_error "Failed to clean up local font directory. Try doing it manually."
fi
···
# Print the `nf_array` line by line and pipe to `gum choose --no-limit`.
# Create `selection` array from the output of `gum choose --no-limit`.
# It will contain only the items that were selected by the user.
+
mapfile -t selection < <(printf "%s\n" "${nf_array[@]}" | gum choose --no-limit)
# Prompt for user confirmation and proceed with installation of nerd fonts.
#
···
# Clean up local font directory. Removes everything besides fonts.
if ! gum spin --spinner dot --title "Cleaning up local font directory..." \
-- find "${LOCAL_FONT_DIR}" -mindepth 1 \
+
-not -name "*.otf" \
+
-not -name "*.ttf" \
+
-not -name "static" \
+
-exec rm -rf {} \;; then
gum_error "Failed to clean up local font directory. Try doing it manually."
fi