package editor
import "k8s.io/kubectl/pkg/cmd/util/editor"
Index ¶
- func GetApplyPatch(obj runtime.Unstructured) ([]byte, []byte, types.PatchType, error)
- type EditMode
- type EditOptions
- func NewEditOptions(editMode EditMode, ioStreams genericiooptions.IOStreams) *EditOptions
- func (o *EditOptions) Complete(f cmdutil.Factory, args []string, cmd *cobra.Command) error
- func (o *EditOptions) Run() error
- func (o *EditOptions) Validate() error
- type Editor
Functions ¶
func GetApplyPatch ¶
GetApplyPatch is used to get and apply patches
Types ¶
type EditMode ¶
type EditMode string
EditMode can be either NormalEditMode, EditBeforeCreateMode or ApplyEditMode
const ( // NormalEditMode is an edit mode NormalEditMode EditMode = "normal_mode" // EditBeforeCreateMode is an edit mode EditBeforeCreateMode EditMode = "edit_before_create_mode" // ApplyEditMode is an edit mode ApplyEditMode EditMode = "edit_last_applied_mode" )
type EditOptions ¶
type EditOptions struct { resource.FilenameOptions RecordFlags *genericclioptions.RecordFlags PrintFlags *genericclioptions.PrintFlags ToPrinter func(string) (printers.ResourcePrinter, error) OutputPatch bool WindowsLineEndings bool cmdutil.ValidateOptions ValidationDirective string OriginalResult *resource.Result EditMode EditMode CmdNamespace string ApplyAnnotation bool ChangeCause string genericiooptions.IOStreams Recorder genericclioptions.Recorder FieldManager string Subresource string // contains filtered or unexported fields }
EditOptions contains all the options for running edit cli command.
func NewEditOptions ¶
func NewEditOptions(editMode EditMode, ioStreams genericiooptions.IOStreams) *EditOptions
NewEditOptions returns an initialized EditOptions instance
func (*EditOptions) Complete ¶
Complete completes all the required options
func (*EditOptions) Run ¶
func (o *EditOptions) Run() error
Run performs the execution
func (*EditOptions) Validate ¶
func (o *EditOptions) Validate() error
Validate checks the EditOptions to see if there is sufficient information to run the command.
type Editor ¶
Editor holds the command-line args to fire up the editor
func NewDefaultEditor ¶
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 ¶
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 ¶
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.
Source Files ¶
editoptions.go editor.go launcher_others.go
Directories ¶
Path | Synopsis |
---|---|
pkg/cmd/util/editor/crlf |
- Version
- v0.32.3 (latest)
- Published
- Mar 12, 2025
- Platform
- linux/amd64
- Imports
- 35 packages
- Last checked
- 5 days ago –
Tools for package owners.