MCPcopy
hub / github.com/Jguer/yay / syncList

Function syncList

cmd.go:411–452  ·  view source on GitHub ↗
(ctx context.Context, run *runtime.Runtime,
	httpClient *http.Client, cmdArgs *parser.Arguments, dbExecutor db.Executor,
)

Source from the content-addressed store, hash-verified

409}
410
411func syncList(ctx context.Context, run *runtime.Runtime,
412 httpClient *http.Client, cmdArgs *parser.Arguments, dbExecutor db.Executor,
413) error {
414 aur := false
415
416 for i, v := range slices.Backward(cmdArgs.Targets) {
417 if v == "aur" && run.Cfg.Mode.AtLeastAUR() {
418 cmdArgs.Targets = append(cmdArgs.Targets[:i], cmdArgs.Targets[i+1:]...)
419 aur = true
420 }
421 }
422
423 if run.Cfg.Mode.AtLeastAUR() && (len(cmdArgs.Targets) == 0 || aur) {
424 scanner, err := download.GetPackageScanner(ctx, httpClient, run.Cfg.AURURL, run.Logger)
425 if err != nil {
426 return err
427 }
428 defer scanner.Close()
429
430 for scanner.Scan() {
431 name := scanner.Text()
432 if cmdArgs.ExistsArg("q", "quiet") {
433 run.Logger.Println(name)
434 } else {
435 run.Logger.Printf("%s %s %s", text.Magenta("aur"), text.Bold(name), text.Bold(text.Green(gotext.Get("unknown-version"))))
436
437 if dbExecutor.LocalPackage(name) != nil {
438 run.Logger.Print(text.Bold(text.Blue(gotext.Get(" [Installed]"))))
439 }
440
441 run.Logger.Println()
442 }
443 }
444 }
445
446 if run.Cfg.Mode.AtLeastRepo() && (len(cmdArgs.Targets) != 0 || !aur) {
447 return run.CmdBuilder.Show(run.CmdBuilder.BuildPacmanCmd(ctx,
448 cmdArgs, run.Cfg.Mode, settings.NoConfirm))
449 }
450
451 return nil
452}

Callers 1

handleSyncFunction · 0.85

Calls 15

GetPackageScannerFunction · 0.92
MagentaFunction · 0.92
BoldFunction · 0.92
GreenFunction · 0.92
BlueFunction · 0.92
AtLeastAURMethod · 0.80
ExistsArgMethod · 0.80
PrintlnMethod · 0.80
PrintfMethod · 0.80
AtLeastRepoMethod · 0.80
GetMethod · 0.65
LocalPackageMethod · 0.65

Tested by

no test coverage detected