Documentation ¶
Overview ¶
Package config parses, validates and normalizes configuration files.
Index ¶
- Variables
- type Clones
- type Config
- type Daemon
- type DriverRegistry
- func (r *DriverRegistry) RegisterSourceDriver(alias string, reg sourcedriver.Registration)
- func (r *DriverRegistry) RegisterVCSDriver(alias string, reg vcsdriver.Registration)
- func (r *DriverRegistry) SourceDriverAliases() []string
- func (r *DriverRegistry) SourceDriverByAlias(alias string) (sourcedriver.Registration, bool)
- func (r *DriverRegistry) SourceDrivers() map[string]sourcedriver.Registration
- func (r *DriverRegistry) VCSDriverAliases() []string
- func (r *DriverRegistry) VCSDriverByAlias(alias string) (vcsdriver.Registration, bool)
- func (r *DriverRegistry) VCSDrivers() map[string]vcsdriver.Registration
- type Source
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultDirectory is the standard location for Grit configuration files. DefaultDirectory = filepath.Join("~", ".config", "grit") // DefaultClonesDirectory is the default path in which grit stores local // clones of remote repositories. DefaultClonesDirectory = filepath.Join("~", "grit") )
Functions ¶
This section is empty.
Types ¶
type Clones ¶
type Clones struct { // Dir is the path to the directory in which local clones are kept. Dir string }
Clones is the configuration that controls how Grit stores local clones of remote repositories.
type Config ¶
type Config struct { // Daemon is the configuration of the Grit daemon. Daemon Daemon // Sources is the set of repository sources from which repositories can be // cloned. Sources []Source }
Config contains an entire Grit configuration.
func Load ¶
func Load(dir string, reg *DriverRegistry) (Config, error)
Load loads the configuration from all files in the given directory.
If the directory doesn't exist or does not contain any configuration files, then DefaultConfig is returned.
reg is a registry of drivers that can be used within the configuration. It may be nil.
type Daemon ¶
type Daemon struct { // Socket is the path of the Unix socket used for communication between // the Grit CLI and the Grit daemon (via gRPC). Socket string }
Daemon holds the configuration for the Grit daemon.
type DriverRegistry ¶
type DriverRegistry struct { Parent *DriverRegistry // contains filtered or unexported fields }
DriverRegistry is a collection of driver implementations that are available to the configuration.
func (*DriverRegistry) RegisterSourceDriver ¶
func (r *DriverRegistry) RegisterSourceDriver(alias string, reg sourcedriver.Registration)
RegisterSourceDriver adds a source driver to the registry.
func (*DriverRegistry) RegisterVCSDriver ¶
func (r *DriverRegistry) RegisterVCSDriver(alias string, reg vcsdriver.Registration)
RegisterVCSDriver adds a VCS driver to the registry.
func (*DriverRegistry) SourceDriverAliases ¶
func (r *DriverRegistry) SourceDriverAliases() []string
SourceDriverAliases returns a sorted slice containing the aliases of all registered source drivers.
func (*DriverRegistry) SourceDriverByAlias ¶
func (r *DriverRegistry) SourceDriverByAlias(alias string) (sourcedriver.Registration, bool)
SourceDriverByAlias returns the source driver with the given alias.
func (*DriverRegistry) SourceDrivers ¶
func (r *DriverRegistry) SourceDrivers() map[string]sourcedriver.Registration
SourceDrivers returns all of the registered source drivers.
func (*DriverRegistry) VCSDriverAliases ¶
func (r *DriverRegistry) VCSDriverAliases() []string
VCSDriverAliases returns a sorted slice containing the aliases of all registered VCS drivers.
func (*DriverRegistry) VCSDriverByAlias ¶
func (r *DriverRegistry) VCSDriverByAlias(alias string) (vcsdriver.Registration, bool)
VCSDriverByAlias returns the VCS driver with the given alias.
func (*DriverRegistry) VCSDrivers ¶
func (r *DriverRegistry) VCSDrivers() map[string]vcsdriver.Registration
VCSDrivers returns all of the registered vcs drivers.
type Source ¶
type Source struct { // Name is a short identifier for the source. Each source in the // configuration has a unique name. Names are case-insensitive. Name string // Enabled is true if the source is enabled. Disabled sources are not used // when searching for repositories to be cloned. Enabled bool // Clones is the configuration that controls how Grit stores local // repository clones for this source. Clones Clones // Driver contains driver-specific configuration for this source. Driver sourcedriver.Config }
Source is the configuration for a source of repositories.