6
0
mirror of https://github.com/grdl/git-get.git synced 2026-02-07 22:49:18 +00:00

Refactor config provider using viper

This commit is contained in:
Grzegorz Dlugoszewski
2020-06-04 11:38:01 +02:00
parent 205eecc073
commit f2d8496136
7 changed files with 142 additions and 130 deletions

View File

@@ -8,6 +8,7 @@ import (
"sort"
"strings"
"github.com/spf13/viper"
"github.com/xlab/treeprint"
"github.com/go-git/go-git/v5"
@@ -24,7 +25,7 @@ var repos []string
func FindRepos() ([]string, error) {
repos = []string{}
root := Cfg.ReposRoot()
root := viper.GetString(KeyReposRoot)
if _, err := os.Stat(root); err != nil {
return nil, fmt.Errorf("Repos root %s does not exist or can't be accessed", root)
@@ -105,7 +106,7 @@ func OpenAll(paths []string) ([]*Repo, error) {
}
func PrintRepos(repos []*Repo) {
root := Cfg.ReposRoot()
root := viper.GetString(KeyReposRoot)
seg := make([][]string, len(repos))