Skip to content
This repository has been archived by the owner on Nov 4, 2022. It is now read-only.

Commit

Permalink
feat(pull-request): open editor when comment is empty
Browse files Browse the repository at this point in the history
Uses user's default git editor when they pass an empty --comment

re #34
  • Loading branch information
Ryan Garant committed Nov 4, 2019
1 parent 15fdcbf commit 468ec80
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/cmds/pull-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export async function run(options, done) {
}
}

if (options.comment) {
if (options.comment || options.comment === '') {
await _commentHandler(options)
}

Expand Down Expand Up @@ -295,9 +295,16 @@ async function close(options) {
}

async function comment(options) {
const body =
let body =
logger.applyReplacements(options.comment, options.config.replace) + options.config.signature

if (userLeftMsgEmpty(body)) {
body = openFileInEditor(
'temp-gh-pr-comment.md',
'<!-- Add an pr comment message in markdown format below -->'
)
}

const payload = {
body,
issue_number: options.number,
Expand Down Expand Up @@ -832,7 +839,7 @@ async function submit(options, user) {
if (userLeftMsgEmpty(title)) {
title = openFileInEditor(
'temp-gh-pr-title.txt',
`# Add a issue title message on the next line\n${git.getLastCommitMessage(pullBranch)}`
`# Add a pr title message on the next line\n${git.getLastCommitMessage(pullBranch)}`
)
}

Expand Down

0 comments on commit 468ec80

Please sign in to comment.