editor

package
v1.10.7-beta.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2018 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetApplyPatch added in v1.7.0

func GetApplyPatch(obj runtime.Object, codec runtime.Encoder) ([]byte, []byte, types.PatchType, error)

Types

type EditMode added in v1.7.0

type EditMode string
const (
	NormalEditMode       EditMode = "normal_mode"
	EditBeforeCreateMode EditMode = "edit_before_create_mode"
	ApplyEditMode        EditMode = "edit_last_applied_mode"
)

type EditOptions added in v1.7.0

type EditOptions struct {
	resource.FilenameOptions

	Output             string
	OutputPatch        bool
	WindowsLineEndings bool

	cmdutil.ValidateOptions

	ResourceMapper *resource.Mapper
	OriginalResult *resource.Result

	EditMode EditMode

	CmdNamespace    string
	ApplyAnnotation bool
	Record          bool
	ChangeCause     string
	Include3rdParty bool

	Out    io.Writer
	ErrOut io.Writer
	// contains filtered or unexported fields
}

EditOptions contains all the options for running edit cli command.

func (*EditOptions) Complete added in v1.7.0

func (o *EditOptions) Complete(f cmdutil.Factory, out, errOut io.Writer, args []string, cmd *cobra.Command) error

Complete completes all the required options

func (*EditOptions) Run added in v1.7.0

func (o *EditOptions) Run() error

func (*EditOptions) Validate added in v1.7.0

func (o *EditOptions) Validate() error

Validate checks the EditOptions to see if there is sufficient information to run the command.

type Editor

type Editor struct {
	Args  []string
	Shell bool
}

func NewDefaultEditor

func NewDefaultEditor(envs []string) Editor

NewDefaultEditor creates a struct Editor that uses the OS environment to locate the editor program, looking at EDITOR environment variable to find the proper command line. If the provided editor has no spaces, or no quotes, it is treated as a bare command to be loaded. Otherwise, the string will be passed to the user's shell for execution.

func (Editor) Launch

func (e Editor) Launch(path string) error

Launch opens the described or returns an error. The TTY will be protected, and SIGQUIT, SIGTERM, and SIGINT will all be trapped.

func (Editor) LaunchTempFile

func (e Editor) LaunchTempFile(prefix, suffix string, r io.Reader) ([]byte, string, error)

LaunchTempFile reads the provided stream into a temporary file in the given directory and file prefix, and then invokes Launch with the path of that file. It will return the contents of the file after launch, any errors that occur, and the path of the temporary file so the caller can clean it up as needed.

Jump to

Keyboard shortcuts

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