MCPcopy
hub / github.com/cli/cli / DetermineEditor

Function DetermineEditor

pkg/cmdutil/legacy.go:12–23  ·  view source on GitHub ↗

TODO: consider passing via Factory TODO: support per-hostname settings

(cf func() (gh.Config, error))

Source from the content-addressed store, hash-verified

10// TODO: consider passing via Factory
11// TODO: support per-hostname settings
12func DetermineEditor(cf func() (gh.Config, error)) (string, error) {
13 editorCommand := os.Getenv("GH_EDITOR")
14 if editorCommand == "" {
15 cfg, err := cf()
16 if err != nil {
17 return "", fmt.Errorf("could not read config: %w", err)
18 }
19 editorCommand = cfg.Editor("").Value
20 }
21
22 return editorCommand, nil
23}

Callers 10

newPrompterFunction · 0.92
createRunFunction · 0.92
NewCmdEditFunction · 0.92
editRunFunction · 0.92
prompterRunFunction · 0.92
EditMethod · 0.92
CommentableEditSurveyFunction · 0.92
EditMethod · 0.92
RetrieveMethod · 0.92

Calls 2

ErrorfMethod · 0.65
EditorMethod · 0.65

Tested by

no test coverage detected