Documentation
¶
Index ¶
- func GetProfilesPathForApp(appName string) (string, error)
- func NewProfilesCommand(appName string, initialContentProvider InitialContentProvider) (*cobra.Command, error)
- type InitialContentProvider
- type LayerName
- type LayerSettings
- type ProfileLayers
- type ProfileName
- type Profiles
- type ProfilesEditor
- func (p *ProfilesEditor) DeleteLayer(profile, layer string) error
- func (p *ProfilesEditor) DeleteLayerValue(profile, layer, key string) error
- func (p *ProfilesEditor) DeleteProfile(profile string) error
- func (p *ProfilesEditor) DuplicateProfile(sourceProfile, newProfile string) error
- func (p *ProfilesEditor) GetLayerValue(profile, layer, key string) (string, error)
- func (p *ProfilesEditor) GetProfileLayers(profile ProfileName) (ProfileLayers, error)
- func (p *ProfilesEditor) ListProfiles() ([]ProfileName, map[ProfileName]map[LayerName]map[SettingName]SettingValue, ...)
- func (p *ProfilesEditor) Save() error
- func (p *ProfilesEditor) SetLayerValue(profile, layer, key, value string) error
- type SettingName
- type SettingValue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetProfilesPathForApp ¶
GetProfilesPathForApp returns the default path for the profiles YAML file for a given application name. It typically uses ~/.config/<appName>/profiles.yaml.
func NewProfilesCommand ¶
func NewProfilesCommand(appName string, initialContentProvider InitialContentProvider) (*cobra.Command, error)
NewProfilesCommand creates the "profiles" command group for managing application profiles. It requires the application name (used for the config directory) and a function to provide the initial content for a new profiles file.
Types ¶
type InitialContentProvider ¶
type InitialContentProvider func() string
InitialContentProvider is a function type that returns the default content for a new profiles file.
type LayerSettings ¶
type LayerSettings = *orderedmap.OrderedMap[SettingName, SettingValue]
type ProfileLayers ¶
type ProfileLayers = *orderedmap.OrderedMap[LayerName, LayerSettings]
type ProfileName ¶
type ProfileName = string
type Profiles ¶
type Profiles = *orderedmap.OrderedMap[ProfileName, ProfileLayers]
type ProfilesEditor ¶
type ProfilesEditor struct {
// contains filtered or unexported fields
}
func NewProfilesEditor ¶
func NewProfilesEditor(path string) (*ProfilesEditor, error)
func (*ProfilesEditor) DeleteLayer ¶
func (p *ProfilesEditor) DeleteLayer(profile, layer string) error
func (*ProfilesEditor) DeleteLayerValue ¶
func (p *ProfilesEditor) DeleteLayerValue(profile, layer, key string) error
func (*ProfilesEditor) DeleteProfile ¶
func (p *ProfilesEditor) DeleteProfile(profile string) error
func (*ProfilesEditor) DuplicateProfile ¶
func (p *ProfilesEditor) DuplicateProfile(sourceProfile, newProfile string) error
DuplicateProfile copies an existing profile to a new name.
func (*ProfilesEditor) GetLayerValue ¶
func (p *ProfilesEditor) GetLayerValue(profile, layer, key string) (string, error)
func (*ProfilesEditor) GetProfileLayers ¶
func (p *ProfilesEditor) GetProfileLayers(profile ProfileName) (ProfileLayers, error)
GetProfileLayers returns the layers for a specific profile as an ordered map.
func (*ProfilesEditor) ListProfiles ¶
func (p *ProfilesEditor) ListProfiles() ([]ProfileName, map[ProfileName]map[LayerName]map[SettingName]SettingValue, error)
ListProfiles returns the names of all profiles and their full content.
func (*ProfilesEditor) Save ¶
func (p *ProfilesEditor) Save() error
func (*ProfilesEditor) SetLayerValue ¶
func (p *ProfilesEditor) SetLayerValue(profile, layer, key, value string) error
type SettingName ¶
type SettingName = string
type SettingValue ¶
type SettingValue = string