mirror of
https://github.com/taigrr/mg.git
synced 2026-04-02 03:28:42 -07:00
add test stub and docstrings
This commit is contained in:
@@ -6,11 +6,18 @@ import (
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
// MGConfig is the struct that represents the mgconfig file
|
||||
// It contains a slice of Repo structs and a map of aliases
|
||||
// The aliases map is a map of strings to strings, where the key is the alias
|
||||
// and the value is a command to be run
|
||||
type MGConfig struct {
|
||||
Repos []Repo
|
||||
Aliases map[string]string
|
||||
}
|
||||
|
||||
// GetRepoPaths returns a slice of strings containing the paths of the repos
|
||||
// in the mgconfig file
|
||||
|
||||
func (m MGConfig) GetRepoPaths() []string {
|
||||
paths := []string{}
|
||||
for _, r := range m.Repos {
|
||||
@@ -19,6 +26,9 @@ func (m MGConfig) GetRepoPaths() []string {
|
||||
return paths
|
||||
}
|
||||
|
||||
// LoadMGConfig loads the mgconfig file from the XDG_CONFIG_HOME directory
|
||||
// or from the default location of $HOME/.config/mgconfig
|
||||
// If the file is not found, an error is returned
|
||||
func LoadMGConfig() (MGConfig, error) {
|
||||
var config MGConfig
|
||||
mgConf := os.Getenv("MGCONFIG")
|
||||
|
||||
Reference in New Issue
Block a user