Cleanup main loop

This commit is contained in:
2024-08-04 21:22:44 -04:00
parent 8ea6a10ecc
commit 7857080db6

View File

@@ -366,24 +366,6 @@ interactive_header() {
underline=$(tput smul)
nounderline=$(tput rmul)
# Ask to make our custom R library the default
if [[ -z $R_LIBS_USER || $R_LIBS_USER != "$HOME/R/$SCRIPT_NAME" ]]; then
echo "This script uses a local R library at $HOME/R/$SCRIPT_NAME"
echo "You can install the R dependencies to this library using the install_dependencies module"
if ((YES)) || ask "Would you like to make this R library the default for your user?"; then
line="export R_LIBS_USER=$HOME/R/$SCRIPT_NAME"
if ! grep -qF "$line" ~/.bashrc; then
echo "Adding $line to your .bashrc"
echo "If you use a different shell, update your R_LIBS_USER environment variable accordingly"
echo "$line" >> ~/.bashrc
fi
fi
declare -gx R_LIBS_USER="$HOME/R/$SCRIPT_NAME"
else
debug "R_LIBS_USER already set to $HOME/R/$SCRIPT_NAME"
fi
echo ""
echo "${underline}Available Modules${nounderline}"
# Determine if we need two columns
if [[ ${#ALL_MODULES[@]} -gt 8 ]]; then
@@ -427,7 +409,7 @@ interactive_header() {
fi
echo ""
echo "Available Submodules:"
echo "${underline}Available Submodules${nounderline}"
# Determine if we need two columns
if [[ ${#ALL_SUBMODULES[@]} -gt 8 ]]; then
# Calculate the number of elements in each column
@@ -479,7 +461,7 @@ interactive_header() {
echo "No projects found in $SCANS_DIR"
ask_pn && PROJECTS+=("${ADD_PROJECTS[@]}")
else
echo "Available Projects:"
echo "${underline}Available Projects${nounderline}"
projects=("${projects[@]%/}") # strip comma first!
projects=("${projects[@]##*/}")
@@ -525,6 +507,24 @@ interactive_header() {
fi
fi
# Ask to make our custom R library the default
if [[ -z $R_LIBS_USER || $R_LIBS_USER != "$HOME/R/$SCRIPT_NAME" ]]; then
echo "This script uses a local R library at $HOME/R/$SCRIPT_NAME"
echo "You can install the R dependencies to this library using the install_dependencies module"
if ((YES)) || ask "Would you like to make this R library the default for your user?"; then
line="export R_LIBS_USER=$HOME/R/$SCRIPT_NAME"
if ! grep -qF "$line" ~/.bashrc; then
echo "Adding $line to your .bashrc"
echo "If you use a different shell, update your R_LIBS_USER environment variable accordingly"
echo "$line" >> ~/.bashrc
fi
fi
declare -gx R_LIBS_USER="$HOME/R/$SCRIPT_NAME"
else
debug "R_LIBS_USER already set to $HOME/R/$SCRIPT_NAME"
fi
echo ""
# Let user choose or add project(s)
if [[ ${#PROJECTS[@]} -eq 0 ]]; then
num=$((${#projects[@]}))