Make ask_pn() more friendly
This commit is contained in:
@@ -226,13 +226,30 @@ err() { echo "Error: $*" >&2; }
|
|||||||
ask_pn() {
|
ask_pn() {
|
||||||
unset PROJECT
|
unset PROJECT
|
||||||
declare -g PROJECT
|
declare -g PROJECT
|
||||||
word1=$(shuf -n 1 /usr/share/dict/words)
|
cat <<-EOF
|
||||||
word2=$(shuf -n 1 /usr/share/dict/words)
|
Enter a new or existing project name, ex. ${PROJECT_PREFIX}_$(random_words 3)
|
||||||
word3=$(shuf -n 1 /usr/share/dict/words)
|
If entering a new project, use the suggested prefix: ${PROJECT_PREFIX}_
|
||||||
read -r -p "Enter a new or existing project name, ex. ${PROJECT_PREFIX}_${word1}_${word2}_${word3}: " PROJECT
|
You may choose any combination of words/characters following the prefix, but be sensible.
|
||||||
|
Make it descriptive and avoid spaces and special characters.
|
||||||
|
EOF
|
||||||
|
read -r -p "Enter a new or existing project name: " PROJECT
|
||||||
[[ -z $PROJECT ]]
|
[[ -z $PROJECT ]]
|
||||||
}
|
}
|
||||||
debug() { (( DEBUG )) && echo "Debug: $*"; }
|
debug() { (( DEBUG )) && echo "Debug: $*"; }
|
||||||
|
# Not super portable but nice to have
|
||||||
|
random_words() {
|
||||||
|
local num=${1:-2}
|
||||||
|
local -a arr
|
||||||
|
for ((i=0;i<num;i++)); do
|
||||||
|
word=$(shuf -n1 /usr/share/dict/words | sed -e 's/-//g' -e 's/_//g')
|
||||||
|
# Sanitize
|
||||||
|
word="${word//-/}"
|
||||||
|
word="${word//_/}"
|
||||||
|
word="${word,,}"
|
||||||
|
arr+=("$word")
|
||||||
|
done
|
||||||
|
printf "%s_" "${arr[@]}" | sed 's/_$//'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# @section Modules
|
# @section Modules
|
||||||
@@ -244,7 +261,6 @@ debug() { (( DEBUG )) && echo "Debug: $*"; }
|
|||||||
# * Dictating the ordering of multiple submodules
|
# * Dictating the ordering of multiple submodules
|
||||||
# * Modules should competently handle pushd and popd for their submodules if they do not reside in the SCANS/PROJECT_DIR
|
# * Modules should competently handle pushd and popd for their submodules if they do not reside in the SCANS/PROJECT_DIR
|
||||||
|
|
||||||
|
|
||||||
module install_dependencies
|
module install_dependencies
|
||||||
# @section Install dependencies
|
# @section Install dependencies
|
||||||
# @description Installs dependencies for the workflow
|
# @description Installs dependencies for the workflow
|
||||||
@@ -278,9 +294,9 @@ install_dependencies() {
|
|||||||
debug "Running: ${FUNCNAME[0]}" "$@"
|
debug "Running: ${FUNCNAME[0]}" "$@"
|
||||||
|
|
||||||
# Dependency arrays
|
# Dependency arrays
|
||||||
depends_rpm=(graphviz pandoc pdftk-java gd-devel shdoc nano rsync)
|
depends_rpm=(graphviz pandoc pdftk-java gd-devel shdoc nano rsync coreutils)
|
||||||
depends_deb=(graphviz pandoc pdftk-java libgd-dev shdoc nano rsync)
|
depends_deb=(graphviz pandoc pdftk-java libgd-dev shdoc nano rsync coreutils)
|
||||||
depends_brew=(graphiz pandoc gd pdftk-java shdoc nano rsync)
|
depends_brew=(graphiz pandoc gd pdftk-java shdoc nano rsync coreutils)
|
||||||
depends_perl=(File::Map ExtUtils::PkgConfig GD GO::TermFinder)
|
depends_perl=(File::Map ExtUtils::PkgConfig GD GO::TermFinder)
|
||||||
depends_r=(BiocManager ontologyIndex ggrepel tidyverse sos openxlsx ggplot2
|
depends_r=(BiocManager ontologyIndex ggrepel tidyverse sos openxlsx ggplot2
|
||||||
plyr extrafont gridExtra gplots stringr plotly ggthemes pandoc rmarkdown
|
plyr extrafont gridExtra gplots stringr plotly ggthemes pandoc rmarkdown
|
||||||
|
|||||||
Reference in New Issue
Block a user