Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
feat(vim-patch.sh): support additional args for -s
This allows creating a draft vim-patch PR.
  • Loading branch information
zeertzjq committed Mar 5, 2022
1 parent 83fc914 commit 0ec92bb
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions scripts/vim-patch.sh
Expand Up @@ -36,7 +36,7 @@ usage() {
echo " can be a Vim version (8.0.xxx) or a Git hash."
echo " -P {vim-revision} Download, generate and apply a Vim patch."
echo " -g {vim-revision} Download a Vim patch."
echo " -s Create a vim-patch pull request."
echo " -s [pr args] Create a vim-patch pull request."
echo " -r {pr-number} Review a vim-patch pull request."
echo " -V Clone the Vim source code to \$VIM_SOURCE_DIR."
echo
Expand Down Expand Up @@ -329,7 +329,8 @@ stage_patch() {
* Do this only for _related_ patches (otherwise it increases the
size of the pull request, making it harder to review)
When you are done, try "%s -s" to create the pull request.
When you are done, try "%s -s" to create the pull request,
or "%s -s --draft" to create a draft pull request.
See the wiki for more information:
* https://github.com/neovim/neovim/wiki/Merging-patches-from-upstream-vim
Expand All @@ -338,13 +339,19 @@ stage_patch() {
}

gh_pr() {
gh pr create --title "$1" --body "$2"
local pr_title
local pr_body
pr_title="$1"
pr_body="$2"
shift 2
gh pr create --title "${pr_title}" --body "${pr_body}" "$@"
}

git_hub_pr() {
local pr_message
pr_message="$(printf '%s\n\n%s\n' "$1" "$2")"
git hub pull new -m "${pr_message}"
shift 2
git hub pull new -m "${pr_message}" "$@"
}

submit_pr() {
Expand Down Expand Up @@ -408,7 +415,7 @@ submit_pr() {
fi

echo "Creating pull request."
if output="$($submit_fn "$pr_title" "$pr_body" 2>&1)"; then
if output="$($submit_fn "$pr_title" "$pr_body" "$@" 2>&1)"; then
msg_ok "$output"
else
msg_err "$output"
Expand Down Expand Up @@ -799,7 +806,8 @@ while getopts "hlLmMVp:P:g:r:s" opt; do
exit 0
;;
s)
submit_pr
shift # remove opt
submit_pr "$@"
exit 0
;;
V)
Expand Down

0 comments on commit 0ec92bb

Please sign in to comment.