blob: 35ca85bfdbe69a20bf363b93a43715678f086dce (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#!/usr/bin/env bash
if [ $# -ne 1 ]; then
echo "usage: rm <name>"
exit 1
fi
set -xe
base_dir="$HOME"
target="$1"
case $target in
*\.git)
;;
*)
target="${target}.git"
;;
esac
if [ -d "$target" ]; then
printf "Confirm delete? [y/N] "
read -r confirm
if [ "${confirm,,}" = "y" ]; then
rm -rf "${base_dir:?}/${target:?}" \
&& echo "Deleted Git repository ${target}"
fi
else
echo "$target does not exist."
fi
|