Documentation
¶
Overview ¶
Package editor launches the user's external editor to compose review comments. Editor variables routinely carry arguments (e.g. "nvim -f", "code --wait"), so the command line is parsed into a program plus arguments rather than handed to a shell. The actual process launch is performed by the caller (the TUI uses tea.ExecProcess so the alternate screen is released and restored correctly); this package builds the *exec.Cmd and manages the temp file and template stripping.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildTemplate ¶
func BuildTemplate(ctx TemplateContext, body string) string
BuildTemplate renders the initial editor buffer: an HTML-comment header with context, followed by any prior body. The header is stripped after editing, so the reviewer never has to delete it manually.
func CleanTemplate ¶
CleanTemplate removes HTML comment blocks and trims surrounding whitespace, yielding the reviewer's note.
func Edit ¶
Edit is a convenience blocking helper for non-TUI callers: it opens the editor, waits, and returns the cleaned result.
func SplitCommand ¶
SplitCommand tokenises a command line with minimal shell semantics: it respects single and double quotes and backslash escapes, splitting on unquoted whitespace. It intentionally does not expand variables or globs.
Types ¶
type Editor ¶
Editor is a resolved editor invocation: a program and any fixed arguments that precede the file path.
type Session ¶
type Session struct {
Path string
// contains filtered or unexported fields
}
Session owns a temporary Markdown file for one editing round.
func NewSession ¶
NewSession writes initial content to a fresh temp .md file whose name carries context (so the editor's title bar is useful).