Documentation
¶
Overview ¶
Package editor runs the user's editor without a shell and retains private drafts until a caller explicitly discards them after confirmation.
Index ¶
- func Command(configured string, getenv func(string) string) ([]string, error)
- func Edit(ctx context.Context, argv []string, d *Draft, stdin io.Reader, ...) (string, error)
- func FormatTaskBuffer(title, notes string) string
- func ParseLogBuffer(s string) (title, notes string, err error)
- func ParseTaskBuffer(s string) (title, notes string, err error)
- func SplitWords(s string) ([]string, error)
- type Draft
- type Drafts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Edit ¶
func Edit(ctx context.Context, argv []string, d *Draft, stdin io.Reader, stdout, stderr io.Writer) (string, error)
Edit appends the draft path to argv, runs the editor with the supplied streams, and reads the resulting buffer. It never discards the draft, even on success.
func FormatTaskBuffer ¶
FormatTaskBuffer places the title on line one and separates notes with a blank.
func ParseLogBuffer ¶
ParseLogBuffer uses the first non-empty line as the title, then parses notes like ParseTaskBuffer.
func ParseTaskBuffer ¶
ParseTaskBuffer trims the first line as the title and skips one blank separator line, preserving the remaining notes verbatim.
func SplitWords ¶
SplitWords splits whitespace-separated arguments, honoring single quotes, double quotes and backslash escapes. It never expands shell expressions.