MCPcopy Create free account
hub / github.com/cli/cli / TitledEditSurvey

Function TitledEditSurvey

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

Source from the content-addressed store, hash-verified

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

Callers 2

NewCmdCreateFunction · 0.92

Calls 2

JoinMethod · 0.80
EditMethod · 0.65

Tested by 1