MCPcopy
hub / github.com/cli/cli / TitledEditSurvey

Function TitledEditSurvey

pkg/cmd/pr/shared/survey.go:416–429  ·  view source on GitHub ↗
(editor Editor)

Source from the content-addressed store, hash-verified

414Lines below dotted lines will be ignored, and an empty title aborts the creation process.`
415
416func TitledEditSurvey(editor Editor) func(string, string) (string, string, error) {
417 return func(initialTitle, initialBody string) (string, string, error) {
418 initialValue := strings.Join([]string{initialTitle, initialBody, editorHintMarker, editorHint}, "\n")
419 titleAndBody, err := editor.Edit("*.md", initialValue)
420 if err != nil {
421 return "", "", err
422 }
423
424 titleAndBody = strings.ReplaceAll(titleAndBody, "\r\n", "\n")
425 titleAndBody, _, _ = strings.Cut(titleAndBody, editorHintMarker)
426 title, body, _ := strings.Cut(titleAndBody, "\n")
427 return title, strings.TrimSuffix(body, "\n"), nil
428 }
429}
430
431func InitEditorMode(f *cmdutil.Factory, editorMode bool, webMode bool, canPrompt bool) (bool, error) {
432 if err := cmdutil.MutuallyExclusive(

Callers 2

NewCmdCreateFunction · 0.92

Calls 2

JoinMethod · 0.80
EditMethod · 0.65

Tested by 1