diff options
| Commit | f522fb4f17114d48e2de5b60a9b34dea350e77cb (patch) | |
|---|---|---|
| Author | 2026-10-31 11:01:59 +0200 | |
| Committer | 2026-10-31 11:10:51 +0200 | |
| Files | 949be2ee14d89675cd8723c6da3a91e30f32d9a9 /scripts/public | |
| cli-f522fb4f17114d48e2de5b60a9b34dea350e77cb.tar cli-f522fb4f17114d48e2de5b60a9b34dea350e77cb.tar.gz cli-f522fb4f17114d48e2de5b60a9b34dea350e77cb.zip | ||
feat!: Initial setup
1 files changed, 33 insertions, 0 deletions
| -rwxr-xr-x | scripts/public | 33 |
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" |
