profiles

package
v1.0.7-0...-053f393 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetOptionValue

func GetOptionValue(opt options.Option) (pFlagValue string, err error)

func Validate

func Validate() error

Types

type ActiveProfile

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

func (ActiveProfile) Name

func (a ActiveProfile) Name() string

func (ActiveProfile) ViperInstance

func (a ActiveProfile) ViperInstance() *viper.Viper

type MainConfig

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

func GetMainConfig

func GetMainConfig() *MainConfig

Returns the MainViper struct

func NewMainConfig

func NewMainConfig() (newMainViper *MainConfig)

Returns a new MainViper instance

func (MainConfig) ActiveProfile

func (m MainConfig) ActiveProfile() *ActiveProfile

func (*MainConfig) ChangeActiveProfile

func (m *MainConfig) ChangeActiveProfile(pName string) (err error)

func (MainConfig) ChangeProfileDescription

func (m MainConfig) ChangeProfileDescription(pName, description string) (err error)

func (MainConfig) ChangeProfileName

func (m MainConfig) ChangeProfileName(oldPName, newPName string) (err error)

func (MainConfig) DeleteProfile

func (m MainConfig) DeleteProfile(pName string) (err error)

Viper gives no built-in delete or unset method for keys Using this "workaround" described here: https://github.com/spf13/viper/issues/632

func (MainConfig) ProfileNames

func (m MainConfig) ProfileNames() (profileNames []string)

Get all profile names from config.yaml configuration file

func (MainConfig) ProfileToString

func (m MainConfig) ProfileToString(pName string) (yamlStr string, err error)

func (MainConfig) ProfileViperValue

func (m MainConfig) ProfileViperValue(pName, viperKey string) (yamlStr string, err error)

func (MainConfig) SaveProfile

func (m MainConfig) SaveProfile(pName string, subViper *viper.Viper) (err error)

func (MainConfig) ValidateExistingProfileName

func (m MainConfig) ValidateExistingProfileName(pName string) (err error)

The profile name format must be valid The profile name must exist

func (MainConfig) ValidateNewProfileName

func (m MainConfig) ValidateNewProfileName(pName string) (err error)

The profile name format must be valid The new profile name must be unique

func (MainConfig) ValidateProfileNameFormat

func (m MainConfig) ValidateProfileNameFormat(pName string) (err error)

The profile name must contain only alphanumeric characters, underscores, and dashes The profile name cannot be empty

func (MainConfig) ValidateUpdateExistingProfileName

func (m MainConfig) ValidateUpdateExistingProfileName(ePName, newPName string) (err error)

If the new profile name is the same as the existing profile name, that is valid Otherwise treat newPName as a new profile name and validate it

func (MainConfig) ViperInstance

func (m MainConfig) ViperInstance() *viper.Viper

Jump to

Keyboard shortcuts

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