From 23854de888eb389617a3e5c112615da2f0d50e60 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 15 May 2024 04:02:48 +0100 Subject: [PATCH] option.sh: delete check_git() it's only used from main() in the main build script, and it's very small, as is main() therefore, move the logic into main() Signed-off-by: Leah Rowe --- build | 9 ++++++++- include/option.sh | 10 ---------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/build b/build index 7429897..d4465d1 100755 --- a/build +++ b/build @@ -27,7 +27,14 @@ main() [ "$1" = "dependencies" ] && x_ install_packages $@ && cbmk_exit 0 - for cmd in initcmd check_git git_init excmd; do + which git 1>/dev/null 2>/dev/null || \ + git_err "git not installed. please install git-scm." + git config --global user.name 1>/dev/null 2>/dev/null || \ + git_err "git config --global user.name \"John Doe\"" + git config --global user.email 1>/dev/null 2>/dev/null || \ + git_err "git config --global user.email \"john.doe@example.com\"" + + for cmd in initcmd git_init excmd; do eval "${cmd} \$@" done cbmk_exit 0 diff --git a/include/option.sh b/include/option.sh index 5642bd5..1d9fb37 100755 --- a/include/option.sh +++ b/include/option.sh @@ -144,16 +144,6 @@ remkdir() mkdir -p "${1}" || $err "remkdir: !mkdir -p \"${1}\"" } -check_git() -{ - which git 1>/dev/null 2>/dev/null || \ - git_err "git not installed. please install git-scm." - git config --global user.name 1>/dev/null 2>/dev/null || \ - git_err "git config --global user.name \"John Doe\"" - git config --global user.email 1>/dev/null 2>/dev/null || \ - git_err "git config --global user.email \"john.doe@example.com\"" -} - git_err() { printf "You need to set git name/email, like so:\n%s\n\n" "$1" 1>&2