editor

package
v0.0.0-...-4ce2ee0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Edit

func Edit(obj interface{}, marshalFn MarshalFn, unmarshalFn UnmarshalFn, configs ...Config) (res interface{}, err error)

func EditWithRetry

func EditWithRetry(obj interface{}, marshalFn MarshalFn, unmarshalFn UnmarshalFn, checkFn func(interface{}) error, configs ...Config) (res interface{}, err error)

func EditYaml

func EditYaml(obj interface{}, configs ...Config) (res interface{}, err error)

func EditYamlWithRetry

func EditYamlWithRetry(obj interface{}, checkFn func(interface{}) error, configs ...Config) (res interface{}, err error)

func MustOpen

func MustOpen(initialContent []byte, configs ...Config) []byte

func Open

func Open(initialContent []byte, configs ...Config) ([]byte, error)

func WithEditor

func WithEditor(editor string) func(*config)

func WithStderr

func WithStderr(f *os.File) func(*config)

func WithStdin

func WithStdin(f *os.File) func(*config)

func WithStdout

func WithStdout(f *os.File) func(*config)

Types

type Config

type Config func(*config)

type Editor

type Editor interface {
	Edit(interface{}) (interface{}, error)
}

func NewObjectEditor

func NewObjectEditor(marshalFn MarshalFn, unmarshalFn UnmarshalFn, configs ...Config) Editor

type MarshalFn

type MarshalFn func(interface{}) ([]byte, error)

type RetryEditor

type RetryEditor interface {
	EditWithRetry(interface{}, func(interface{}) error) (interface{}, error)
}

func NewObjEditorWithRetry

func NewObjEditorWithRetry(marshalFn MarshalFn, unmarshalFn UnmarshalFn, configs ...Config) RetryEditor

func NewYamlObjEditorWithRetry

func NewYamlObjEditorWithRetry(configs ...Config) RetryEditor

type UnmarshalFn

type UnmarshalFn func([]byte, interface{}) error

Jump to

Keyboard shortcuts

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