editor

package
v5.12.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package editor provides editor configuration resolution for CLI commands.

This package handles resolving the appropriate text editor for various CLI operations (cipher edit, workload edit, cluster connect) with proper precedence: flags > config > environment variables > fallback editors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupEnv

func SetupEnv(editorFlag, forCommand string) func()

SetupEnv sets up the editor environment variables based on flag and config. 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