TODO: consider passing via Factory TODO: support per-hostname settings
(cf func() (gh.Config, error))
| 10 | // TODO: consider passing via Factory |
| 11 | // TODO: support per-hostname settings |
| 12 | func 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 | } |
no test coverage detected