cloudcode / repo-helper.sh
ummmar's picture
Update repo-helper.sh
0df17ab verified
Raw History Blame Contribute Delete
769 Bytes
#!/bin/bash
cd /workspace/projects
case "$1" in
clone)
if [ -z "$2" ]; then echo "Usage: repo clone <github-url>"; exit 1; fi
git clone "$2"
echo "Cloned into $(basename "$2" .git)"
;;
save)
MSG="${2:-Auto-save from OpenCode}"
git add .
git commit -m "$MSG" || echo "Nothing to commit."
git push
echo "Pushed to GitHub."
;;
new)
if [ -z "$2" ]; then echo "Usage: repo new <folder-name>"; exit 1; fi
mkdir "$2" && cd "$2"
git init
echo "# $2" > README.md
git add . && git commit -m "Initial commit"
echo "Created local repo. Push to GitHub to deploy."
;;
*)
echo "Usage: repo [clone|save|new]"
;;
esac