Make the default depth configurable
This commit is contained in:
parent
f6983c78d0
commit
0ee35feeb1
4 changed files with 12 additions and 3 deletions
|
|
@ -6,7 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
Nothing yet.
|
### Added
|
||||||
|
|
||||||
|
- Set a default `depth` in config.yaml and remove the hard-coded value.
|
||||||
|
|
||||||
## [0.1.0]
|
## [0.1.0]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
|
Depth string `yaml:"depth"`
|
||||||
Directories []string `yaml:"directories"`
|
Directories []string `yaml:"directories"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"git-repo-updater/internal/config"
|
||||||
"git-repo-updater/internal/utils"
|
"git-repo-updater/internal/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -36,10 +37,15 @@ func FindInDirectory(dir string) (string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func splitPath(repoPath string) (string, string) {
|
func splitPath(repoPath string) (string, string) {
|
||||||
|
cfg, err := config.Load()
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
}
|
||||||
|
|
||||||
parts := strings.SplitN(repoPath, ":", 2)
|
parts := strings.SplitN(repoPath, ":", 2)
|
||||||
|
|
||||||
repoPath = parts[0]
|
repoPath = parts[0]
|
||||||
depth := "2"
|
depth := cfg.Depth
|
||||||
|
|
||||||
if len(parts) == 2 {
|
if len(parts) == 2 {
|
||||||
return parts[0], parts[1]
|
return parts[0], parts[1]
|
||||||
|
|
|
||||||
2
todo.txt
2
todo.txt
|
|
@ -1,8 +1,8 @@
|
||||||
* Load directories from a configuration file
|
* Load directories from a configuration file
|
||||||
* Update the repositories within each directory.
|
* Update the repositories within each directory.
|
||||||
* Make depth configurable per directory.
|
* Make depth configurable per directory.
|
||||||
|
* Set a default depth in config.yaml.
|
||||||
|
|
||||||
Set a default depth in config.yaml.
|
|
||||||
Add unit tests.
|
Add unit tests.
|
||||||
Add a `--dry-run` option.
|
Add a `--dry-run` option.
|
||||||
Complete README.
|
Complete README.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue