Imported from prdlk/dotfiles master (efdd827), which supersedes the omarchy branch (3031416). Drops the Umbriel, Noctalia, niri, CachyOS, macOS, and Blume docs-site layers; docs/ is plain Markdown.
29 lines
931 B
Bash
Executable File
29 lines
931 B
Bash
Executable File
#!/bin/sh
|
|
# Create a new private repo (prad.codes via tea, or github.com via gh),
|
|
# clone it with ghq, and print the clone directory for the shell wrapper to cd.
|
|
repo=$1
|
|
if [ -z "$repo" ]; then
|
|
echo "usage: ghn <repo-name>" >&2
|
|
exit 1
|
|
fi
|
|
|
|
host=$(gum choose "prad.codes" "github.com") || exit 1
|
|
|
|
if [ "$host" = prad.codes ]; then
|
|
owner=$(tea organizations list -o simple | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' | gum choose) || exit 1
|
|
[ -n "$owner" ] || exit 1
|
|
|
|
tea repos create --name "$repo" --owner "$owner" --private >&2 || exit 1
|
|
|
|
ghq get "https://prad.codes/$owner/$repo" >&2 || exit 1
|
|
printf '%s\n' "$(ghq root)/prad.codes/$owner/$repo"
|
|
else
|
|
owner=$(gum choose "prdlk" "wltbs") || exit 1
|
|
[ -n "$owner" ] || exit 1
|
|
|
|
gh repo create "$owner/$repo" --private >&2 || exit 1
|
|
|
|
ghq get "github.com/$owner/$repo" >&2 || exit 1
|
|
printf '%s\n' "$(ghq root)/github.com/$owner/$repo"
|
|
fi
|