impr: externalizez sh scripts

This commit is contained in:
2025-07-03 10:14:33 +02:00
parent a9bdca55b5
commit c8f88b2410
6 changed files with 246 additions and 229 deletions

25
src/sh/cligit.sh Normal file
View File

@@ -0,0 +1,25 @@
if [ "${1:-}" = "--git-init" ]; then
shift
if [ -n "${GIT:-}" ]; then
err "Git already enabled"
return 1
fi
if ! command -v "git" >/dev/null; then
err "Git not installed"
return 1
fi
git -C "$ROOT" init
git -C "$ROOT" add -A
git -C "$ROOT" commit -m 'Initial commit: Start git tracking'
exit
fi
if [ "${1:-}" = "--git" ]; then
shift
if [ -z "${GIT:-}" ]; then
err "Git not supported, run \`$0 --git-init\` first"
return 1
fi
$GIT "$@"
exit
fi