Documentation
¶
Index ¶
- Variables
- func Get(key string) interface{}
- func GetBool(key string) bool
- func GetProjectConfigPath() string
- func GetString(key string) string
- func HasProjectConfig() bool
- func Init(cfgFile string) error
- func InitProjectConfig() error
- func Save() error
- func SaveProjectConfig(settings map[string]interface{}) error
- func Set(key string, value interface{})
- func TestInitProjectConfig_Unix(t *testing.T)
- type Config
- type Provider
- func (p *Provider) AllSettings() map[string]interface{}
- func (p *Provider) Get(key string) interface{}
- func (p *Provider) GetBool(key string) bool
- func (p *Provider) GetInt(key string) int
- func (p *Provider) GetProjectConfigPath() string
- func (p *Provider) GetString(key string) string
- func (p *Provider) GetStringMap(key string) map[string]interface{}
- func (p *Provider) GetStringSlice(key string) []string
- func (p *Provider) HasProjectConfig() bool
- func (p *Provider) InitProjectConfig() error
- func (p *Provider) IsSet(key string) bool
- func (p *Provider) Save() error
- func (p *Provider) Set(key string, value interface{})
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultConfigDir is the default configuration directory DefaultConfigDir = filepath.Join(os.Getenv("HOME"), ".config", "cu") // ConfigFileName is the name of the config file ConfigFileName = "config" // ConfigType is the type of the config file ConfigType = "yaml" // ProjectConfigFileName is the name of the project config file ProjectConfigFileName = ".cu.yml" )
Functions ¶
func GetProjectConfigPath ¶
func GetProjectConfigPath() string
GetProjectConfigPath returns the path to the project config file
func HasProjectConfig ¶
func HasProjectConfig() bool
HasProjectConfig returns true if a project config file was found
func InitProjectConfig ¶
func InitProjectConfig() error
InitProjectConfig creates a new project config file in the current directory
func SaveProjectConfig ¶
SaveProjectConfig saves configuration to the project config file
Types ¶
type Config ¶
type Config struct {
DefaultSpace string `mapstructure:"default_space"`
DefaultFolder string `mapstructure:"default_folder"`
DefaultList string `mapstructure:"default_list"`
Output string `mapstructure:"output"`
Debug bool `mapstructure:"debug"`
APIToken string `mapstructure:"api_token"`
Workspaces map[string]string `mapstructure:"workspaces"`
}
Config represents the application configuration
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider wraps viper to implement the ConfigProvider interface
func NewWithViper ¶
NewWithViper creates a new config provider with a specific viper instance
func (*Provider) AllSettings ¶
AllSettings returns all settings
func (*Provider) GetProjectConfigPath ¶
GetProjectConfigPath returns the path to the project config file
func (*Provider) GetStringMap ¶
GetStringMap returns a string map configuration value
func (*Provider) GetStringSlice ¶
GetStringSlice returns a string slice configuration value
func (*Provider) HasProjectConfig ¶
HasProjectConfig returns true if a project config file was found
func (*Provider) InitProjectConfig ¶
InitProjectConfig creates a new project config file