commit 3b9e9950f092720aceb7785054993f03cd597db9
parent ae1630c43b66d73e5927dbf3a49babe676bc519f
Author: Oliver Lowe <o@olowe.co>
Date: Sat, 19 Jul 2025 15:23:20 +0700
bbpr: write man page
Diffstat:
3 files changed, 65 insertions(+), 3 deletions(-)
diff --git a/README b/README
@@ -5,6 +5,7 @@ To install, run install.sh.
The following commands are provided:
- backlight - set backlight brightness
+- bbpr - create a Bitbucket pull request
- bbsnip - create a snippet on BitBucket
- hits - count web traffic
- hlsget - download the contents of a HLS playlist
diff --git a/bin/bbpr b/bin/bbpr
@@ -16,6 +16,9 @@ dest=main
if git branch --list master | grep master > /dev/null
then
dest=master
+elif test -n $1
+then
+ dest=$1
fi
cover=`mktemp`
@@ -23,12 +26,10 @@ git log $dest.. | grep -v '^commit' > $cover
if test -n $EDITOR
then
- EDITOR=vi
+ EDITOR=ed
fi
$EDITOR $cover
-
title=`sed -n 1p $cover`
-
description=`awk 'NR > 2 { print }' $cover`
rm $cover
diff --git a/man/bbpr.1 b/man/bbpr.1
@@ -0,0 +1,60 @@
+.Dd
+.Dt BBPR 1
+.Sh NAME
+.Nm bbpr
+.Nd create a Bitbucket pull request
+.Sh SYNOPSIS
+.Nm
+.Op Ar branch
+.Sh DESCRIPTION
+.Nm
+creates a Bitbucket pull request to merge the currently checked-out branch
+with the named
+.Ar branch
+of the remote
+.Ar origin .
+If no destination
+.Ar branch
+is specified,
+.Ar main ,
+then
+.Ar master
+are tried.
+A URL pointing to the pull request is created on success.
+.Pp
+.Nm
+prompts for a pull request
+.Dq cover letter ,
+similar to
+.Xr git-commit 1 ,
+by reading the
+.Ev EDITOR
+environment variable;
+otherwise
+.Xr ed 1 .
+The first line is the pull request's title.
+The second line is ignored and should be empty.
+The rest becomes the description.
+.Sh FILES
+.Bl -tag -width Ds
+.It Pa $HOME/.config/atlassian/bitbucket.org
+Configuration file containing a Bitbucket API token.
+.El
+.Sh EXIT STATUS
+.Ex
+.Sh EXAMPLES
+Create a pull request to merge test_refactor into main:
+.Bd -literal -offset indent
+git switch test_refactor
+bbpr
+.Ed
+.Pp
+Create a pull request to merge typo into test_refactor:
+.Bd -literal -offset indent
+git switch typo
+bbpr test_refactor
+.Ed
+.Sh SEE ALSO
+.Xr curl 1 ,
+.Xr jq 1 ,
+.Lk https://developer.atlassian.com/cloud/bitbucket/rest/api-group-pullrequests Bitbucket pull requests API reference