editor

package
v1.0.0-alpha.9 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Editor

type Editor struct {
	*context.Context
	// contains filtered or unexported fields
}

Editor displays content to a user using an external text editor, like vi or notepad. The content is captured and returned.

The `EDITOR` environment variable is checked to find an editor. Failing that, use some sensible default depending on the operating system.

This is useful for editing things like configuration files, especially those that might be stored on a remote server. For example: the content could be retrieved from the remote store, edited locally, then saved back.

func New

func New(context *context.Context, tempFilename string, contents []byte) *Editor

New returns a new Editor with the temp filename and contents provided.

func (*Editor) Run

func (e *Editor) Run() ([]byte, error)

Run opens the editor, displaying the contents through a temporary file. The content is returned once the editor closes.

Jump to

Keyboard shortcuts

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