From e2b50f6a252b96dd35ac21448c569eb97e26c016 Mon Sep 17 00:00:00 2001 From: Thomas Forgione Date: Thu, 20 Feb 2020 17:02:37 +0100 Subject: [PATCH] Update basic --- bin/basic | 49 +++++++++++++++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/bin/basic b/bin/basic index b360b11..759ac05 100755 --- a/bin/basic +++ b/bin/basic @@ -1,5 +1,17 @@ #!/usr/bin/env bash +if [ "$BASIC_BASE_URL" == "" ]; then + base_url="https://gitea.tforgione.fr/basic/" + custom_base_url=false +else + base_url=$BASIC_BASE_URL + echo $base_url | grep /$ > /dev/null 2>&1 + if [ $? -ne 0 ]; then + base_url="$base_url"/ + fi + custom_base_url=true +fi + eprint() { echo -e >&2 "\x1B[1;31merror:\x1B[0m" $@ } @@ -15,15 +27,17 @@ info_n() { print-help() { echo -e "\033[32mbasic\033[0m" echo -e "Thomas Forgione " - echo -e "A script that automatically clones templates" + echo -e "A script that automatically clones templates from $base_url" + echo -e "Use the environment variable BASIC_BASE_URL to clone templates from somewhere else." echo - print-usage + print-usage } print-usage() { echo -e "\033[33mUSAGE:\033[0m" - echo -e " \033[32mbasic init \033[0m initialize a template in the current directory" - echo -e " \033[32mbasic init \033[0m initialize a template in the specified directory" + echo -e " \033[32mbasic init