config

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultDirMod default unix perms for k9s directory.
	DefaultDirMod os.FileMode = 0755
	// DefaultFileMod default unix perms for k9s files.
	DefaultFileMod os.FileMode = 0600
)
View Source
const CloudlensConfig = "CLOUDLENSCONFIG"

CloudlensConfig represents Cloudlens configuration dir env var.

Variables

View Source
var CloudlensAlias = filepath.Join(CloudlensHome(), "alias.yml")

CloudlensAlias manages Cloudlens aliases.

View Source
var (
	//CloudlensConfigFile represents config file location.
	CloudlensConfigFile = filepath.Join(CloudlensHome(), "config.yml")
)

Functions

func CloudlensHome

func CloudlensHome() string

CloudlensHome returns Cloudlens configs home directory.

func EnsureFullPath

func EnsureFullPath(path string, mod os.FileMode)

EnsureFullPath ensures a directory exist from the given path.

func EnsurePath

func EnsurePath(path string, mod os.FileMode)

EnsurePath ensures a directory exist from the given path.

func GetProfiles

func GetProfiles() (profiles []string, err error)

func GetSession

func GetSession(profile, region string) (*session.Session, error)

func LookupForValue

func LookupForValue(profiles []string, value string) bool

Types

type Active

type Active struct {
	Profile string `yaml:"profile"`
	Region  string `yaml:"region"`
	View    string `yaml:"view"`
}

type Alias

type Alias map[string]string

Alias tracks shortname to GVR mappings.

type Aliases

type Aliases struct {
	Alias Alias `yaml:"alias"`
	// contains filtered or unexported fields
}

Aliases represents a collection of aliases.

func NewAliases

func NewAliases() *Aliases

NewAliases return a new alias.

func (*Aliases) Clear

func (a *Aliases) Clear()

Clear remove all aliases.

func (*Aliases) Define

func (a *Aliases) Define(resource string, aliases ...string)

Define declares a new alias.

func (*Aliases) Get

func (a *Aliases) Get(k string) (string, bool)

Get retrieves an alias.

func (*Aliases) Keys

func (a *Aliases) Keys() []string

Keys returns all aliases keys.

func (*Aliases) Load

func (a *Aliases) Load() error

Load Cloudlens aliases.

func (*Aliases) LoadFileAliases

func (a *Aliases) LoadFileAliases(path string) error

LoadFileAliases loads alias from a given file.

func (*Aliases) Save

func (a *Aliases) Save() error

Save alias to disk.

func (*Aliases) SaveAliases

func (a *Aliases) SaveAliases(path string) error

SaveAliases saves aliases to a given file.

func (*Aliases) ShortNames

func (a *Aliases) ShortNames() ShortNames

ShortNames return all shortnames.

type Border

type Border struct {
	FgColor    Color `yaml:"fgColor"`
	FocusColor Color `yaml:"focusColor"`
}

Border tracks border styles.

type Cloudlens

type Cloudlens struct {
	EnableMouse bool    `yaml:"enableMouse"`
	Headless    bool    `yaml:"headless"`
	Logoless    bool    `yaml:"logoless"`
	Crumbsless  bool    `yaml:"crumbsless"`
	Active      *Active `yaml:"active"`
}

func NewCloudlens

func NewCloudlens() *Cloudlens

NewCloudlens create a new Cloudlens configuration.

type Color

type Color string
const (
	// DefaultColor represents  a default color.
	DefaultColor Color = "default"

	// TransparentColor represents the terminal bg color.
	TransparentColor Color = "-"
)

func (Color) Color

func (c Color) Color() tcell.Color

Color returns a view color.

func (Color) String

func (c Color) String() string

type Config

type Config struct {
	Cloudlens *Cloudlens `yaml:"cloudlens"`
	// List of profiles in (~/.aws/credentials)
	Profiles  []string
	AwsConfig awsV2.Config
}

func Get

func Get() (Config, error)

func (*Config) Load

func (c *Config) Load(path string) error

Load cloudlens configuration from file.

func (*Config) Save

func (c *Config) Save() error

Save configuration to disk.

func (*Config) SaveFile

func (c *Config) SaveFile(path string) error

SaveFile K9s configuration to disk.

type Crumb

type Crumb struct {
	FgColor     Color `yaml:"fgColor"`
	BgColor     Color `yaml:"bgColor"`
	ActiveColor Color `yaml:"activeColor"`
}

Crumb tracks crumbs styles.

type Frame

type Frame struct {
	Title  Title  `yaml:"title"`
	Border Border `yaml:"border"`
	Menu   Menu   `yaml:"menu"`
	Crumb  Crumb  `yaml:"crumbs"`
	Status Status `yaml:"status"`
}

type IsSwapHappen

type IsSwapHappen bool

func SwapFirstIndexWithValue

func SwapFirstIndexWithValue(array []string, value string) ([]string, IsSwapHappen)

SwapFirstIndexWithValue return swapped array if match found. If match not found returns same array and says match not found.

type Menu struct {
	FgColor     Color `yaml:"fgColor"`
	KeyColor    Color `yaml:"keyColor"`
	NumKeyColor Color `yaml:"numKeyColor"`
}

type ShortNames

type ShortNames map[string][]string

ShortNames represents a collection of shortnames for aliases.

type Status

type Status struct {
	NewColor       Color `yaml:"newColor"`
	ModifyColor    Color `yaml:"modifyColor"`
	AddColor       Color `yaml:"addColor"`
	PendingColor   Color `yaml:"pendingColor"`
	ErrorColor     Color `yaml:"errorColor"`
	HighlightColor Color `yaml:"highlightColor"`
	KillColor      Color `yaml:"killColor"`
	CompletedColor Color `yaml:"completedColor"`
}

type Title

type Title struct {
	FgColor        Color `yaml:"fgColor"`
	BgColor        Color `yaml:"bgColor"`
	HighlightColor Color `yaml:"highlightColor"`
	CounterColor   Color `yaml:"counterColor"`
	FilterColor    Color `yaml:"filterColor"`
}

Jump to

Keyboard shortcuts

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