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

Commit

Permalink
feat(issue): dont open editor when use_editor is false
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Garant committed Nov 5, 2019
1 parent 9e810c4 commit be7e5b0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
10 changes: 1 addition & 9 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,7 @@
"type": "node",
"request": "launch",
"runtimeArgs": ["-r", "ts-node/register"],
"args": [
"${workspaceFolder}/src/debug.ts",
"pr",
"-s",
"protoEvangleion",
"--title",
"dont ask",
"--description"
],
"args": ["${workspaceFolder}/src/debug.ts", "is", "--new"],
// "args": ["${workspaceFolder}/src/debug.ts", "ji", "LWM-117", "--status"],
"console": "integratedTerminal"
},
Expand Down
10 changes: 7 additions & 3 deletions src/cmds/issue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,11 @@ function browser(user, repo, number) {
}

function comment(options) {
const useEditor = options.config.use_editor !== false

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

if (userLeftMsgEmpty(options.comment)) {
if (useEditor && userLeftMsgEmpty(options.comment)) {
body = openFileInEditor(
'temp-gh-issue-comment.md',
'<!-- Add an issue comment message in markdown format below -->'
Expand Down Expand Up @@ -346,6 +348,8 @@ async function listFromAllRepositories(options) {

function newIssue(options) {
options = produce(options, draft => {
const useEditor = draft.config.use_editor !== false

if (draft.labels) {
draft.labels = draft.labels.split(',')
} else {
Expand All @@ -356,7 +360,7 @@ function newIssue(options) {
draft.message = logger.applyReplacements(draft.message, config.replace)
}

if (userLeftMsgEmpty(draft.title)) {
if (useEditor && userLeftMsgEmpty(draft.title)) {
draft.title = openFileInEditor(
'temp-gh-issue-title.txt',
'# Add a issue title message on the next line'
Expand All @@ -365,7 +369,7 @@ function newIssue(options) {

// If user passes an empty title and message, --message will get merged into options.title
// Need to reference the original title not the potentially modified one
if (userLeftMsgEmpty(options.title) || userLeftMsgEmpty(draft.message)) {
if (useEditor && (userLeftMsgEmpty(options.title) || userLeftMsgEmpty(draft.message))) {
draft.message = openFileInEditor(
'temp-gh-issue-body.md',
'<!-- Add an issue body message in markdown format below -->'
Expand Down

0 comments on commit be7e5b0

Please sign in to comment.