fix: use config for IncludeNeeds in Deps and Repos commands

- Add IncludeNeeds() to DepsConfigProvider and ReposConfigProvider
- Update depsConfig in tests
- Use c.IncludeNeeds() in run.go instead of hardcoded false

Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
yxxhero 2026-03-15 10:00:35 +08:00
parent c07a82da70
commit 60214c2c78
3 changed files with 8 additions and 2 deletions

View File

@ -131,7 +131,7 @@ func (a *App) Deps(c DepsConfigProvider) error {
return a.ForEachState(func(run *Run) (_ bool, errs []error) {
errs = run.Deps(c)
return
}, false, c.IncludeTransitiveNeeds(), SetFilter(true))
}, c.IncludeNeeds(), c.IncludeTransitiveNeeds(), SetFilter(true))
}
func (a *App) Repos(c ReposConfigProvider) error {
@ -143,7 +143,7 @@ func (a *App) Repos(c ReposConfigProvider) error {
}
return
}, false, c.IncludeTransitiveNeeds(), SetFilter(true))
}, c.IncludeNeeds(), c.IncludeTransitiveNeeds(), SetFilter(true))
}
func (a *App) Diff(c DiffConfigProvider) error {

View File

@ -39,6 +39,7 @@ type DepsConfigProvider interface {
type ReposConfigProvider interface {
Args() string
IncludeNeeds() bool
IncludeTransitiveNeeds() bool
}

View File

@ -22,6 +22,11 @@ func NewReposImpl(g *GlobalImpl, b *ReposOptions) *ReposImpl {
}
}
// IncludeNeeds returns the include needs
func (r *ReposImpl) IncludeNeeds() bool {
return false
}
// IncludeTransitiveNeeds returns the include transitive needs
func (r *ReposImpl) IncludeTransitiveNeeds() bool {
return false