git-shell-commands/rm
2023-09-09 11:31:52 +02:00

21 lines
471 B
Bash
Executable file

#!/bin/bash
set -euo pipefail
IFS=$'\n'
cd ~git
source git-shell-commands/util.sh
arguments 1 "$#"
origin="$(repo_name_existing "$1")"
if [ -L "$origin" ]; then
printf '%s\n' "Removed '$origin' (symlink, not asking for confirmation)."
rm -rf "$origin"
else
printf '%s' "Are you sure you want to delete '$origin'? (y/N) "
read confirm
case $confirm in
y*|Y*) rm -rf "$origin"; printf '%s\n' "Removed '$origin'."; ;;
*) printf '%s\n' "Cancelling."; ;;
esac
fi