Documentation
¶
Index ¶
- func ConfigExists(path string) bool
- func GetDefaultConfigPath() (string, error)
- func MigrateLegacyConfig(cfg *Config)
- func ValidateInstances(cfg *Config) error
- func WriteConfig(path string, cfg *Config) error
- type AuthConfig
- type Config
- type ConfigFlags
- type Duration
- type FilesConfig
- type GitLabConfig
- type InstanceConfig
- type Loader
- type OutputConfig
- type ValidationConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigExists ¶
ConfigExists checks if a configuration file exists at the given path
func GetDefaultConfigPath ¶
GetDefaultConfigPath returns the default configuration file path
func MigrateLegacyConfig ¶ added in v1.0.0
func MigrateLegacyConfig(cfg *Config)
MigrateLegacyConfig converts legacy single-instance configuration to new multi-instance format. This function automatically migrates when: - GitLab.Instances is empty (new format not used) - GitLab.Instance is set (legacy format present)
The migration preserves all existing configuration and ensures backward compatibility.
func ValidateInstances ¶ added in v1.0.0
ValidateInstances validates the instance configuration. Returns an error if: - Instance names are not unique - Instance URLs are invalid
func WriteConfig ¶
WriteConfig writes the configuration to a file with proper permissions It creates the directory if it doesn't exist and uses atomic write for safety
Types ¶
type AuthConfig ¶
AuthConfig contains authentication settings
type Config ¶
type Config struct {
GitLab GitLabConfig `yaml:"gitlab"`
Auth AuthConfig `yaml:"auth"`
Validation ValidationConfig `yaml:"validation"`
Output OutputConfig `yaml:"output"`
Files FilesConfig `yaml:"files"`
}
Config represents the application configuration
type ConfigFlags ¶
type ConfigFlags struct {
ConfigFile string
Token string
Netrc bool
Instance string
Timeout string
Project string
SkipAPI bool
Strict bool
Output string
Debug bool // --debug flag
Verbosity int // -v, -vv count
Color string
Files []string // From -f flag
Directories []string // From -d flag
}
ConfigFlags represents CLI flag values
type Duration ¶ added in v1.0.0
Duration wraps time.Duration to provide custom YAML marshaling
func (Duration) MarshalYAML ¶ added in v1.0.0
MarshalYAML marshals a duration to YAML as a string (e.g., "30s")
type FilesConfig ¶ added in v0.2.0
type FilesConfig struct {
SearchParent bool `yaml:"search_parent"`
MaxDepth int `yaml:"max_depth"`
IgnorePatterns []string `yaml:"ignore_patterns"`
}
FilesConfig contains file discovery settings
type GitLabConfig ¶
type GitLabConfig struct {
// Legacy single-instance support (deprecated but kept for backward compatibility)
Instance string `yaml:"instance,omitempty"` // DEPRECATED: Use instances instead
Timeout *Duration `yaml:"timeout,omitempty"`
// Multi-instance support
Instances []InstanceConfig `yaml:"instances,omitempty"` // List of configured GitLab instances
}
GitLabConfig contains GitLab instance settings
func (*GitLabConfig) FindInstanceByName ¶ added in v1.0.0
func (c *GitLabConfig) FindInstanceByName(name string) *InstanceConfig
FindInstanceByName searches for an instance by name. Returns nil if not found.
func (*GitLabConfig) FindInstanceByURL ¶ added in v1.0.0
func (c *GitLabConfig) FindInstanceByURL(url string) *InstanceConfig
FindInstanceByURL searches for an instance by normalized URL. Returns nil if not found.
func (*GitLabConfig) GetTimeout ¶ added in v1.0.0
func (c *GitLabConfig) GetTimeout() time.Duration
GetTimeout safely returns the timeout duration from GitLabConfig
type InstanceConfig ¶ added in v1.0.0
type InstanceConfig struct {
Name string `yaml:"name"` // Unique identifier (e.g., "gitlab.com", "work")
URL string `yaml:"url"` // Instance URL (e.g., "https://gitlab.com")
Token string `yaml:"token,omitempty"` // Personal access token
Timeout *Duration `yaml:"timeout,omitempty"` // Optional timeout override for this instance
}
InstanceConfig represents a single GitLab instance configuration
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader handles loading configuration from multiple sources with priority
func NewLoader ¶
func NewLoader(flags *ConfigFlags) *Loader
NewLoader creates a new configuration loader
func (*Loader) GetWarnings ¶ added in v0.3.2
GetWarnings returns any warnings collected during configuration loading
type OutputConfig ¶
type OutputConfig struct {
Format string `yaml:"format"` // text, json, yaml
Verbose bool `yaml:"verbose"`
Debug bool `yaml:"debug"`
Color string `yaml:"color"` // auto, always, never
}
OutputConfig contains output formatting settings
type ValidationConfig ¶
type ValidationConfig struct {
SkipAPI bool `yaml:"skip_api"`
Strict bool `yaml:"strict"`
// Project is NOT loaded from config file (yaml:"-" prevents marshaling)
// It can only be set via CLI flag or environment variable (GCL_PROJECT)
// This allows per-file auto-detection from .git/config
Project string `yaml:"-"`
}
ValidationConfig contains validation behavior settings