Help us shape the future of Go! Take the 2026 Go Developer Survey

editor

package
v0.30.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package editor opens the user's configured text editor on a temporary file and returns the edited content. It is intentionally separate from internal/tui so that callers needing only an editor (not a Bubble Tea UI) don't depend on the heavier TUI package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanMessage added in v0.30.1

func CleanMessage(message string) string

CleanMessage removes comment lines and surrounding blank lines from a message edited in the user's editor.

func Command added in v0.30.1

func Command(editor, filePath string) (*exec.Cmd, error)

Command parses an editor command and appends the target file path.

func Open

func Open(initialContent, filenamePattern string) (string, error)

Open opens the user's preferred editor (see Resolve) with the given initial content and returns the edited content, or an error.

func Resolve added in v0.30.0

func Resolve() (string, error)

Resolve returns the user's preferred editor command.

Editor precedence: GIT_EDITOR > EDITOR > git config core.editor > vi. When no editor is set in the environment, it first checks that interactive use is allowed (so it doesn't hang in CI / non-interactive contexts).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL