refactor(yay): move cfg inside of runtime (#2259)
* rework relationship between runtime and cfg * separate runtime from cfg * simplify instantiation logic * move installer to appropriate package * move operator to sync package * add tests for srcinfo service * consolidate srcinfo service in sync * add logger to srcinfo * add logger to preparer * remove unused text functions * remove remaining text.* from srcinfo * remove global logger parts * remove global org method exports * remove global logger * move text->input * add rule to prevent fmt.Print * update golangci go version * remove outdated FAQs * remove outdated FAQs
This commit is contained in:
74 files changed
+1475
-1367
No files matched your search
@@ -22,9 +22,6 @@ type AURWarnings struct {
|
||||
}
|
||||
|
||||
func NewWarnings(logger *text.Logger) *AURWarnings {
|
||||
if logger == nil {
|
||||
logger = text.GlobalLogger
|
||||
}
|
||||
return &AURWarnings{log: logger}
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -7,19 +7,19 @@ import (
|
||||
"github.com/Jguer/yay/v12/pkg/text"
|
||||
)
|
||||
|
||||
func RemoveInvalidTargets(targets []string, mode parser.TargetMode) []string {
|
||||
func RemoveInvalidTargets(logger *text.Logger, targets []string, mode parser.TargetMode) []string {
|
||||
filteredTargets := make([]string, 0)
|
||||
|
||||
for _, target := range targets {
|
||||
dbName, _ := text.SplitDBFromName(target)
|
||||
|
||||
if dbName == "aur" && !mode.AtLeastAUR() {
|
||||
text.Warnln(gotext.Get("%s: can't use target with option --repo -- skipping", text.Cyan(target)))
|
||||
logger.Warnln(gotext.Get("%s: can't use target with option --repo -- skipping", text.Cyan(target)))
|
||||
continue
|
||||
}
|
||||
|
||||
if dbName != "aur" && dbName != "" && !mode.AtLeastRepo() {
|
||||
text.Warnln(gotext.Get("%s: can't use target with option --aur -- skipping", text.Cyan(target)))
|
||||
logger.Warnln(gotext.Get("%s: can't use target with option --aur -- skipping", text.Cyan(target)))
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ func (a *abstractResults) Less(i, j int) bool {
|
||||
func (s *SourceQueryBuilder) Execute(ctx context.Context, dbExecutor db.Executor, pkgS []string) {
|
||||
var aurErr error
|
||||
|
||||
pkgS = RemoveInvalidTargets(pkgS, s.targetMode)
|
||||
pkgS = RemoveInvalidTargets(s.logger, pkgS, s.targetMode)
|
||||
|
||||
metric := &metrics.Hamming{
|
||||
CaseSensitive: false,
|
||||
|
||||
Reference in new issue
Block a user