Make the default depth configurable

This commit is contained in:
Oliver Davies 2025-07-31 22:39:33 +01:00
parent f6983c78d0
commit 0ee35feeb1
4 changed files with 12 additions and 3 deletions

View file

@ -6,7 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
## [Unreleased]
Nothing yet.
### Added
- Set a default `depth` in config.yaml and remove the hard-coded value.
## [0.1.0]

View file

@ -9,6 +9,7 @@ import (
)
type Config struct {
Depth string `yaml:"depth"`
Directories []string `yaml:"directories"`
}

View file

@ -6,6 +6,7 @@ import (
"os/exec"
"strings"
"git-repo-updater/internal/config"
"git-repo-updater/internal/utils"
)
@ -36,10 +37,15 @@ func FindInDirectory(dir string) (string, error) {
}
func splitPath(repoPath string) (string, string) {
cfg, err := config.Load()
if err != nil {
}
parts := strings.SplitN(repoPath, ":", 2)
repoPath = parts[0]
depth := "2"
depth := cfg.Depth
if len(parts) == 2 {
return parts[0], parts[1]

View file

@ -1,8 +1,8 @@
* Load directories from a configuration file
* Update the repositories within each directory.
* Make depth configurable per directory.
* Set a default depth in config.yaml.
Set a default depth in config.yaml.
Add unit tests.
Add a `--dry-run` option.
Complete README.