add sndev pr command

This commit is contained in:
keyan 2024-03-13 14:29:21 -05:00
parent f94de0f3ac
commit 06bde475e7
1 changed files with 26 additions and 2 deletions

28
sndev
View File

@ -60,7 +60,7 @@ sndev__start() {
cp .env.sample .env.development cp .env.sample .env.development
elif ! git diff --exit-code --diff-algorithm=histogram .env.sample .env.development; then elif ! git diff --exit-code --diff-algorithm=histogram .env.sample .env.development; then
echo ".env.development is different from .env.sample ..." echo ".env.development is different from .env.sample ..."
echo "do you want to merge .env.sample into .env.development? [y/N]" printf "do you want to merge .env.sample into .env.development? [y/N] "
read -r answer read -r answer
if [ "$answer" = "y" ]; then if [ "$answer" = "y" ]; then
# merge .env.sample into .env.development in a posix compliant way # merge .env.sample into .env.development in a posix compliant way
@ -154,7 +154,7 @@ OPTIONS"
} }
sndev__delete() { sndev__delete() {
echo "this will delete the containers, volumes, and orphans - are you sure? [y/N]" printf "this deletes containers, volumes, and orphans - are you sure? [y/N] "
read -r answer read -r answer
if [ "$answer" = "y" ]; then if [ "$answer" = "y" ]; then
docker__compose down --volumes --remove-orphans docker__compose down --volumes --remove-orphans
@ -275,6 +275,27 @@ sndev__help_stacker_lncli() {
docker__stacker_lnd --help docker__stacker_lnd --help
} }
sndev__pr() {
shift
refspec="+refs/pull/$1/head:refs/remotes/pr/$1"
case $(git config --get remote.origin.url) in
"http"*) git fetch https://github.com/stackernews/stacker.news.git "$refspec" ;;
*) git fetch git@github.com:stackernews/stacker.news.git "$refspec" ;;
esac
git checkout "pr/$1"
}
sndev__help_pr() {
help="
fetch and checkout a pr
USAGE
$ sndev pr <pr number>
"
echo "$help"
}
sndev__help() { sndev__help() {
if [ $# -eq 2 ]; then if [ $# -eq 2 ]; then
call "sndev__$1_$2" "$@" call "sndev__$1_$2" "$@"
@ -315,6 +336,9 @@ COMMANDS
psql open psql on db psql open psql on db
prisma run prisma commands prisma run prisma commands
github:
pr fetch and checkout a pr
other: other:
compose docker compose passthrough compose docker compose passthrough
sn_lncli lncli passthrough on sn_lnd sn_lncli lncli passthrough on sn_lnd