config

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2017 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Profiles map[string][]Entry `json:"profiles"`
}

Config is the config file

func NewConfig

func NewConfig() *Config

NewConfig initializes and returns a new Config

func (*Config) GetProfile

func (c *Config) GetProfile(profile string) ([]Entry, bool)

GetProfile gets a profile entries

func (*Config) Load

func (c *Config) Load(filename string) (err error)

Load profiles from json file

func (*Config) RemoveProfile

func (c *Config) RemoveProfile(profile string) bool

RemoveProfile removes a profile

func (*Config) RemoveValue

func (c *Config) RemoveValue(profile string, value string) bool

RemoveValue removes an entry from profile

func (*Config) Save

func (c *Config) Save(filename string) (err error)

Save profiles to json file

func (*Config) SetValue

func (c *Config) SetValue(profile string, entry Entry) bool

SetValue adds an entry to profile

type Entry

type Entry struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

Entry is the entry in config file

Jump to

Keyboard shortcuts

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