Cleanup main loop
This commit is contained in:
@@ -366,24 +366,6 @@ interactive_header() {
|
|||||||
underline=$(tput smul)
|
underline=$(tput smul)
|
||||||
nounderline=$(tput rmul)
|
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}"
|
echo "${underline}Available Modules${nounderline}"
|
||||||
# Determine if we need two columns
|
# Determine if we need two columns
|
||||||
if [[ ${#ALL_MODULES[@]} -gt 8 ]]; then
|
if [[ ${#ALL_MODULES[@]} -gt 8 ]]; then
|
||||||
@@ -427,7 +409,7 @@ interactive_header() {
|
|||||||
fi
|
fi
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
echo "Available Submodules:"
|
echo "${underline}Available Submodules${nounderline}"
|
||||||
# Determine if we need two columns
|
# Determine if we need two columns
|
||||||
if [[ ${#ALL_SUBMODULES[@]} -gt 8 ]]; then
|
if [[ ${#ALL_SUBMODULES[@]} -gt 8 ]]; then
|
||||||
# Calculate the number of elements in each column
|
# Calculate the number of elements in each column
|
||||||
@@ -479,7 +461,7 @@ interactive_header() {
|
|||||||
echo "No projects found in $SCANS_DIR"
|
echo "No projects found in $SCANS_DIR"
|
||||||
ask_pn && PROJECTS+=("${ADD_PROJECTS[@]}")
|
ask_pn && PROJECTS+=("${ADD_PROJECTS[@]}")
|
||||||
else
|
else
|
||||||
echo "Available Projects:"
|
echo "${underline}Available Projects${nounderline}"
|
||||||
projects=("${projects[@]%/}") # strip comma first!
|
projects=("${projects[@]%/}") # strip comma first!
|
||||||
projects=("${projects[@]##*/}")
|
projects=("${projects[@]##*/}")
|
||||||
|
|
||||||
@@ -525,6 +507,24 @@ interactive_header() {
|
|||||||
fi
|
fi
|
||||||
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)
|
# Let user choose or add project(s)
|
||||||
if [[ ${#PROJECTS[@]} -eq 0 ]]; then
|
if [[ ${#PROJECTS[@]} -eq 0 ]]; then
|
||||||
num=$((${#projects[@]}))
|
num=$((${#projects[@]}))
|
||||||
|
|||||||
Reference in New Issue
Block a user