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

Commit

Permalink
feat(issue): open default editor when user passes empty comment
Browse files Browse the repository at this point in the history
This will enable the default git editor to handle markdown text

re #34
  • Loading branch information
Ryan Garant committed Nov 4, 2019
1 parent b9f25d9 commit 1182449
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/cmds/issue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export async function run(options, done) {
await afterHooks('issue.assign', { options })
} else if (options.browser) {
browser(options.user, options.repo, options.number)
} else if (options.comment) {
} else if (options.comment || options.comment === '') {
logger.log(`Adding comment on issue ${number} on ${getUserRepo(options)}`)

try {
Expand Down Expand Up @@ -226,7 +226,14 @@ function browser(user, repo, number) {
}

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

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

const payload = {
body,
Expand Down

0 comments on commit 1182449

Please sign in to comment.