mirror of
https://codeberg.org/hyperreal/bin
synced 2024-11-25 10:23:42 +01:00
Refactor
This commit is contained in:
parent
eae217dc7c
commit
453bc5694d
4
gumssh
4
gumssh
@ -20,13 +20,13 @@ while IFS= read -r line; do
|
|||||||
hostn=$(echo "$line" | awk '{ print $2 }')
|
hostn=$(echo "$line" | awk '{ print $2 }')
|
||||||
hostn_array+=("$hostn")
|
hostn_array+=("$hostn")
|
||||||
fi
|
fi
|
||||||
done < "${SSH_CONFIG}"
|
done <"${SSH_CONFIG}"
|
||||||
|
|
||||||
# Print each member of logins array on a new line and pipe to gum choose.
|
# Print each member of logins array on a new line and pipe to gum choose.
|
||||||
# Store selection.
|
# Store selection.
|
||||||
selection=$(printf "%s\n" "${hostn_array[@]}" | gum choose --header="SSH Host" --limit=1)
|
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 is not aborted by user, pass it to the `autossh -M 0` command.
|
||||||
if [ "${selection}" != "user aborted" ]; then
|
if [ -n "${selection}" ]; then
|
||||||
autossh -M 0 "${selection}"
|
autossh -M 0 "${selection}"
|
||||||
fi
|
fi
|
||||||
|
@ -124,7 +124,7 @@ gum style \
|
|||||||
# Print the `nf_array` line by line and pipe to `gum choose --no-limit`.
|
# 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`.
|
# Create `selection` array from the output of `gum choose --no-limit`.
|
||||||
# It will contain only the items that were selected by the user.
|
# It will contain only the items that were selected by the user.
|
||||||
selection=($(printf "%s\n" "${nf_array[@]}" | gum choose --no-limit))
|
mapfile -t selection < <(printf "%s\n" "${nf_array[@]}" | gum choose --no-limit)
|
||||||
|
|
||||||
# Prompt for user confirmation and proceed with installation of nerd fonts.
|
# Prompt for user confirmation and proceed with installation of nerd fonts.
|
||||||
#
|
#
|
||||||
@ -160,7 +160,7 @@ if ! gum spin --spinner dot --title "Cleaning up local font directory..." \
|
|||||||
-not -name "*.otf" \
|
-not -name "*.otf" \
|
||||||
-not -name "*.ttf" \
|
-not -name "*.ttf" \
|
||||||
-not -name "static" \
|
-not -name "static" \
|
||||||
-exec rm -rf {} \; ; then
|
-exec rm -rf {} \;; then
|
||||||
gum_error "Failed to clean up local font directory. Try doing it manually."
|
gum_error "Failed to clean up local font directory. Try doing it manually."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user