Documentation
¶
Overview ¶
Package config provides configuration management for GitHubby
Index ¶
- Constants
- func EnsureConfigFile() error
- func GetConfigFilePath() (string, error)
- type Config
- type Loader
- func (l *Loader) BindFlag(key string, flag *pflag.Flag) error
- func (l *Loader) GetBool(key string) bool
- func (l *Loader) GetInt(key string) int
- func (l *Loader) GetString(key string) string
- func (l *Loader) Initialize() error
- func (l *Loader) InjectToCommand(cmd *cobra.Command)
- func (l *Loader) IsSet(key string) bool
- func (l *Loader) SetDefault(key string, value interface{})
- func (l *Loader) Viper() *viper.Viper
Constants ¶
View Source
const ( // DefaultConfigFileName is the name of the config file (without extension) DefaultConfigFileName = ".githubby" // DefaultConfigFileType is the config file extension DefaultConfigFileType = "yaml" )
Variables ¶
This section is empty.
Functions ¶
func EnsureConfigFile ¶
func EnsureConfigFile() error
EnsureConfigFile creates the config file with defaults if it doesn't exist
func GetConfigFilePath ¶
GetConfigFilePath returns the path to the config file
Types ¶
type Config ¶
type Config struct {
// Global flags
Verbose bool `yaml:"verbose"`
DryRun bool `yaml:"dry-run"`
Token string `yaml:"token"`
// Clean command
Repository string `yaml:"repository"`
FilterDays int `yaml:"filter-days"`
FilterCount int `yaml:"filter-count"`
// Sync command
User string `yaml:"user"`
Org string `yaml:"org"`
Target string `yaml:"target"`
IncludePrivate bool `yaml:"include-private"`
Include []string `yaml:"include"`
Exclude []string `yaml:"exclude"`
}
Config holds all application configuration
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a new Config with default values
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader manages configuration loading from multiple sources
func (*Loader) Initialize ¶
Initialize sets up the configuration loader
func (*Loader) InjectToCommand ¶
InjectToCommand injects viper config values into command flags that weren't explicitly set via command line
func (*Loader) SetDefault ¶
SetDefault sets a default value for a key
Click to show internal directories.
Click to hide internal directories.