edit

package
v0.0.0-...-0fefa07 Latest Latest
Warning

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

Go to latest
Published: May 13, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Prefix           = "# |"
	PreambleTemplate = `` /* 744-byte string literal not displayed */

)
View Source
const EditorEnvVar = "EDITOR"

Variables

View Source
var (
	ErrNoEditorFound = errors.New("Unable to find editor")
	EditorPaths      = []string{
		"/usr/bin/sensible-editor",
		"/usr/bin/editor",
		"/usr/bin/vim",
		"/usr/bin/vi",
	}
)
View Source
var TemplateFunctions template.FuncMap = template.FuncMap{
	"join":     join,
	"decorate": decorate,
}

Functions

func FindEditorBinary

func FindEditorBinary() string

func NewPreambleReader

func NewPreambleReader(r libio.Reader) *io.PrefixScanner

NewPreambleReader provides a io.Reader implementation which skips the preamble from the provided reader instance

func PreambleLength

func PreambleLength(r libio.Reader) (int64, error)

PreambleLength measures number of lines resembling a preamble. The result is the number of bytes required to skip in order to omit any preamble data.

Types

type Editor

type Editor struct {
	// contains filtered or unexported fields
}

func NewEditor

func NewEditor(bin string, options ...EditorOption) (*Editor, error)

func (*Editor) Open

func (e *Editor) Open(f *libos.File) (err error)

func (*Editor) OpenTemp

func (e *Editor) OpenTemp(ident string) error

type EditorFunc

type EditorFunc func(*libos.File) error

type EditorOption

type EditorOption func(*Editor)

func EditorArgs

func EditorArgs(args ...string) EditorOption

func EditorEnv

func EditorEnv(vars ...string) EditorOption

func EditorPrepare

func EditorPrepare(cb EditorFunc) EditorOption

func EditorRetry

func EditorRetry(cb func(error) bool) EditorOption

func EditorSave

func EditorSave(cb EditorFunc) EditorOption

func EditorStdIn

func EditorStdIn(r libio.Reader) EditorOption

func EditorStdOut

func EditorStdOut(w libio.Writer) EditorOption

func EditorStdin

func EditorStdin(w libio.Writer) EditorOption

func EditorUnchanged

func EditorUnchanged(cb EditorFunc) EditorOption

type PreambleData

type PreambleData struct {
	AppName   string
	Prefix    string
	Providers []string
}

func NewPreambleData

func NewPreambleData() *PreambleData

func (*PreambleData) Write

func (d *PreambleData) Write(w libio.Writer) error

Jump to

Keyboard shortcuts

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