editor

package
v5.72.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package editor provides editor configuration resolution with proper precedence.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupEditorEnv added in v5.30.0

func SetupEditorEnv(cmd *cobra.Command, editorFlag, forCommand string) func()

SetupEditorEnv sets up the editor environment variables based on flag and config. When cmd is non-nil, the --config persistent flag is honored for config loading. It returns a cleanup function that should be called to restore the original environment.

Types

type Resolver

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

Resolver handles editor configuration resolution with proper precedence.

func NewResolver

func NewResolver(flagEditor string, cfg *v1alpha1.Cluster) *Resolver

NewResolver creates a new editor resolver.

func (*Resolver) Resolve

func (r *Resolver) Resolve() string

Resolve resolves the editor command based on precedence: 1. --editor flag 2. spec.editor from config 3. Environment variables (SOPS_EDITOR, KUBE_EDITOR, EDITOR, VISUAL) 4. Fallback to vim, nano, vi.

func (*Resolver) SetEnvVars

func (r *Resolver) SetEnvVars(editorCmd string, forCommand string) func()

SetEnvVars sets the appropriate environment variables for the resolved editor. It returns a cleanup function that restores the original environment.

Jump to

Keyboard shortcuts

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