From 31a70a696cbe893a82ec71534fec1126c458517c Mon Sep 17 00:00:00 2001 From: zachir Date: Tue, 28 Feb 2023 22:04:32 -0600 Subject: reorganize install.sh to be more proper --- install.sh | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/install.sh b/install.sh index 56632a1..748815b 100755 --- a/install.sh +++ b/install.sh @@ -11,18 +11,25 @@ scripts shortcmds sp" -case "$1" in - "-s"|"-S"|"-y"|"-Y") - ___USE_SSH=y - ;; - "-h") - printf "install.sh\n\nUsed to add my other script repos as submodules. Feel free to modfy it to clone yours as well.\n" - printf "-s, -S, -y, and -Y will clone using SSH. -h will show this help menu. Everything else will clone using https.\n" - ;; - *) - unset ___USE_SSH +printhelp () { + printf "install.sh | Used to add my other script repos as submodules. Feel free to modfy it to clone yours as well.\n" + printf " -s) clone repos using ssh\n" + printf " -S) clone repos using https\n" + printf " -h) prints this help message\n" + printf " -u X ) will clone using X as the URL\n" +} + +while getopts "cdhsSu:" o; do case "${o}" in + c) unset SCRIPT_DIRS ;; + d) + [ -n "$SCRIPT_DIRS" ] && SCRIPT_DIRS="$SCRIPT_DIRS\n$OPTARG" + [ -z "$SCRIPT_DIRS" ] && SCRIPT_DIRS="$OPTARG" ;; -esac + s) ___USE_SSH=y ;; + S) unset ___USE_SSH ;; + u) URL="$OPTARG" ;; + *) printhelp ;; +esac done clone_dir () { if [ -d "$1" ]; then -- cgit v1.2.3