From 468ec80f74cda0c0f9b0d4cfc5e49fa7936ff037 Mon Sep 17 00:00:00 2001 From: Ryan Garant Date: Sun, 3 Nov 2019 18:24:44 -0800 Subject: [PATCH] feat(pull-request): open editor when comment is empty Uses user's default git editor when they pass an empty --comment re #34 --- src/cmds/pull-request.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/cmds/pull-request.ts b/src/cmds/pull-request.ts index 8a32859a..c077242e 100755 --- a/src/cmds/pull-request.ts +++ b/src/cmds/pull-request.ts @@ -182,7 +182,7 @@ export async function run(options, done) { } } - if (options.comment) { + if (options.comment || options.comment === '') { await _commentHandler(options) } @@ -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', + '' + ) + } + const payload = { body, issue_number: options.number, @@ -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)}` ) }