@@ -2,6 +2,7 @@ package command
22
33import (
44 "fmt"
5+ "os"
56
67 "github.com/AlecAivazis/survey/v2"
78 "github.com/cli/cli/pkg/githubtemplate"
@@ -82,12 +83,15 @@ func selectTemplate(templatePaths []string) (string, error) {
8283}
8384
8485func titleBodySurvey (cmd * cobra.Command , providedTitle , providedBody string , defs defaults , templatePaths []string ) (* titleBody , error ) {
85- ctx := contextForCommand (cmd )
86- cfg , err := ctx .Config ()
87- if err != nil {
88- return nil , fmt .Errorf ("could not read config: %w" , err )
86+ editorCommand := os .Getenv ("GH_EDITOR" )
87+ if editorCommand == "" {
88+ ctx := contextForCommand (cmd )
89+ cfg , err := ctx .Config ()
90+ if err != nil {
91+ return nil , fmt .Errorf ("could not read config: %w" , err )
92+ }
93+ editorCommand , _ = cfg .Get (defaultHostname , "editor" )
8994 }
90- editorCommand , _ := cfg .Get (defaultHostname , "editor" )
9195
9296 var inProgress titleBody
9397 inProgress .Title = defs .Title
@@ -135,7 +139,7 @@ func titleBodySurvey(cmd *cobra.Command, providedTitle, providedBody string, def
135139 qs = append (qs , bodyQuestion )
136140 }
137141
138- err = SurveyAsk (qs , & inProgress )
142+ err : = SurveyAsk (qs , & inProgress )
139143 if err != nil {
140144 return nil , fmt .Errorf ("could not prompt: %w" , err )
141145 }
0 commit comments