From f522fb4f17114d48e2de5b60a9b34dea350e77cb Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sat, 31 Oct 2026 11:01:59 +0200 Subject: feat!: Initial setup --- scripts/public | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 scripts/public (limited to 'scripts/public') diff --git a/scripts/public b/scripts/public new file mode 100755 index 0000000..155a81e --- /dev/null +++ b/scripts/public @@ -0,0 +1,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" -- cgit v1.3.1-23-gd82d