blob: 155a81e9c96fd3bff5f7ddc1bd9e3c7bfb520aa0 (
plain) (
blame)
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
31
32
33
|
#!/bin/bash
if [ -z "$1" ]
then
printf 'Repository: '
read
set "$REPLY"
fi
if [ ! -f "$1/HEAD" ]
then
echo 'Not a repository!'
exit 1
fi
set "${1##/}"
# If repo is in file
if echo -e "?^$1\$?" | ed -s /public_repos >/dev/null 2>&1
then
echo "Already public!"
# If repo root dir is in file
elif echo -e "?^${1%%/*}?" | ed -s /public_repos >/dev/null 2>&1
then
echo -e "?^${1%%/*}?a\n$1\n.\nw" | ed -s /public_repos
echo "'$1' is now public!"
# Repo and repo root dir are not anywhere in file
else
echo -e "\$a\n$1\n.\nw" | ed -s /public_repos
echo "'$1' is now public!"
fi
echo "https://git.syndamia.com/$1"
|