Wrote echo block method for setup script

This commit is contained in:
Sam Germain 2021-10-24 23:27:08 -06:00
parent 029ddd23c1
commit 7ff16997e9

View File

@ -1,12 +1,16 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#encoding=utf8 #encoding=utf8
function echo_block() {
echo "----------------------------"
echo $1
echo "----------------------------"
}
function check_installed_pip() { function check_installed_pip() {
${PYTHON} -m pip > /dev/null ${PYTHON} -m pip > /dev/null
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "-----------------------------" echo_block "Installing Pip for ${PYTHON}"
echo "Installing Pip for ${PYTHON}"
echo "-----------------------------"
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
${PYTHON} get-pip.py ${PYTHON} get-pip.py
rm get-pip.py rm get-pip.py
@ -37,9 +41,7 @@ function check_installed_python() {
} }
function updateenv() { function updateenv() {
echo "-------------------------" echo_block "Updating your virtual env"
echo "Updating your virtual env"
echo "-------------------------"
if [ ! -f .env/bin/activate ]; then if [ ! -f .env/bin/activate ]; then
echo "Something went wrong, no virtual environment found." echo "Something went wrong, no virtual environment found."
exit 1 exit 1
@ -110,18 +112,14 @@ function install_mac_newer_python_dependencies() {
if [ ! $(brew --prefix --installed hdf5 2>/dev/null) ] if [ ! $(brew --prefix --installed hdf5 2>/dev/null) ]
then then
echo "-------------------------" echo_block "Installing hdf5"
echo "Installing hdf5"
echo "-------------------------"
brew install hdf5 brew install hdf5
fi fi
export HDF5_DIR=$(brew --prefix) export HDF5_DIR=$(brew --prefix)
if [ ! $(brew --prefix --installed c-blosc 2>/dev/null) ] if [ ! $(brew --prefix --installed c-blosc 2>/dev/null) ]
then then
echo "-------------------------" echo_block "Installing c-blosc"
echo "Installing c-blosc"
echo "-------------------------"
brew install c-blosc brew install c-blosc
fi fi
export CBLOSC_DIR=$(brew --prefix) export CBLOSC_DIR=$(brew --prefix)
@ -131,9 +129,7 @@ function install_mac_newer_python_dependencies() {
function install_macos() { function install_macos() {
if [ ! -x "$(command -v brew)" ] if [ ! -x "$(command -v brew)" ]
then then
echo "-------------------------" echo_block "Installing Brew"
echo "Installing Brew"
echo "-------------------------"
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi fi
#Gets number after decimal in python version #Gets number after decimal in python version
@ -160,9 +156,7 @@ function update() {
# Reset Develop or Stable branch # Reset Develop or Stable branch
function reset() { function reset() {
echo "----------------------------" echo_block "Resetting branch and virtual env"
echo "Resetting branch and virtual env"
echo "----------------------------"
if [ "1" == $(git branch -vv |grep -cE "\* develop|\* stable") ] if [ "1" == $(git branch -vv |grep -cE "\* develop|\* stable") ]
then then
@ -200,16 +194,12 @@ function reset() {
} }
function config() { function config() {
echo_block "Please use 'freqtrade new-config -c config.json' to generate a new configuration file."
echo "-------------------------"
echo "Please use 'freqtrade new-config -c config.json' to generate a new configuration file."
echo "-------------------------"
} }
function install() { function install() {
echo "-------------------------"
echo "Installing mandatory dependencies" echo_block "Installing mandatory dependencies"
echo "-------------------------"
if [ "$(uname -s)" == "Darwin" ] if [ "$(uname -s)" == "Darwin" ]
then then
@ -228,20 +218,14 @@ function install() {
echo echo
reset reset
config config
echo "-------------------------" echo_block "Run the bot !"
echo "Run the bot !"
echo "-------------------------"
echo "You can now use the bot by executing 'source .env/bin/activate; freqtrade <subcommand>'." echo "You can now use the bot by executing 'source .env/bin/activate; freqtrade <subcommand>'."
echo "You can see the list of available bot sub-commands by executing 'source .env/bin/activate; freqtrade --help'." echo "You can see the list of available bot sub-commands by executing 'source .env/bin/activate; freqtrade --help'."
echo "You verify that freqtrade is installed successfully by running 'source .env/bin/activate; freqtrade --version'." echo "You verify that freqtrade is installed successfully by running 'source .env/bin/activate; freqtrade --version'."
} }
function plot() { function plot() {
echo " echo_block "Installing dependencies for Plotting scripts"
-----------------------------------------
Installing dependencies for Plotting scripts
-----------------------------------------
"
${PYTHON} -m pip install plotly --upgrade ${PYTHON} -m pip install plotly --upgrade
} }