@@ -74,60 +74,6 @@ func ConfirmSubmission(allowPreview bool, allowMetadata bool) (Action, error) {
7474 }
7575}
7676
77- // Deprecated: use SelectTemplate instead
78- func TemplateSurvey (templateFiles []string , legacyTemplate string , state IssueMetadataState ) (templateContent string , err error ) {
79- if len (templateFiles ) == 0 && legacyTemplate == "" {
80- return
81- }
82-
83- if len (templateFiles ) > 0 {
84- templateContent , err = selectTemplate (templateFiles , legacyTemplate , state .Type )
85- } else {
86- templateContent = string (githubtemplate .ExtractContents (legacyTemplate ))
87- }
88-
89- return
90- }
91-
92- func selectTemplate (nonLegacyTemplatePaths []string , legacyTemplatePath string , metadataType metadataStateType ) (string , error ) {
93- templateResponse := struct {
94- Index int
95- }{}
96- templateNames := make ([]string , 0 , len (nonLegacyTemplatePaths ))
97- for _ , p := range nonLegacyTemplatePaths {
98- templateNames = append (templateNames , githubtemplate .ExtractName (p ))
99- }
100- if metadataType == IssueMetadata {
101- templateNames = append (templateNames , "Open a blank issue" )
102- } else if metadataType == PRMetadata {
103- templateNames = append (templateNames , "Open a blank pull request" )
104- }
105-
106- selectQs := []* survey.Question {
107- {
108- Name : "index" ,
109- Prompt : & survey.Select {
110- Message : "Choose a template" ,
111- Options : templateNames ,
112- },
113- },
114- }
115- if err := prompt .SurveyAsk (selectQs , & templateResponse ); err != nil {
116- return "" , fmt .Errorf ("could not prompt: %w" , err )
117- }
118-
119- if templateResponse .Index == len (nonLegacyTemplatePaths ) { // the user has selected the blank template
120- if legacyTemplatePath != "" {
121- templateContents := githubtemplate .ExtractContents (legacyTemplatePath )
122- return string (templateContents ), nil
123- } else {
124- return "" , nil
125- }
126- }
127- templateContents := githubtemplate .ExtractContents (nonLegacyTemplatePaths [templateResponse .Index ])
128- return string (templateContents ), nil
129- }
130-
13177func BodySurvey (state * IssueMetadataState , templateContent , editorCommand string ) error {
13278 if templateContent != "" {
13379 if state .Body != "" {
0 commit comments