Use correct verb when prompting user to choose packages
ci/woodpecker/push/woodpecker Pipeline was successful
Details
ci/woodpecker/push/woodpecker Pipeline was successful
Details
This commit is contained in:
parent
1377ef1bc9
commit
ead0c79139
4
build.go
4
build.go
|
@ -227,7 +227,7 @@ func buildPackage(ctx context.Context, script string, mgr manager.Manager) ([]st
|
|||
}
|
||||
|
||||
log.Info("Installing build dependencies").Send()
|
||||
installPkgs(ctx, flattenFoundPkgs(found), notFound, mgr)
|
||||
installPkgs(ctx, flattenFoundPkgs(found, "install"), notFound, mgr)
|
||||
}
|
||||
|
||||
var builtDeps, builtNames, repoDeps []string
|
||||
|
@ -239,7 +239,7 @@ func buildPackage(ctx context.Context, script string, mgr manager.Manager) ([]st
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
scripts := getScriptPaths(flattenFoundPkgs(found))
|
||||
scripts := getScriptPaths(flattenFoundPkgs(found, "install"))
|
||||
for _, script := range scripts {
|
||||
pkgPaths, pkgNames, err := buildPackage(ctx, script, mgr)
|
||||
if err != nil {
|
||||
|
|
2
info.go
2
info.go
|
@ -44,7 +44,7 @@ func infoCmd(c *cli.Context) error {
|
|||
os.Exit(1)
|
||||
}
|
||||
|
||||
pkgs := flattenFoundPkgs(found)
|
||||
pkgs := flattenFoundPkgs(found, "show")
|
||||
|
||||
for _, pkg := range pkgs {
|
||||
err = yaml.NewEncoder(os.Stdout).Encode(pkg)
|
||||
|
|
|
@ -52,7 +52,7 @@ func installCmd(c *cli.Context) error {
|
|||
log.Fatal("Error finding packages").Err(err).Send()
|
||||
}
|
||||
|
||||
installPkgs(c.Context, flattenFoundPkgs(found), notFound, mgr)
|
||||
installPkgs(c.Context, flattenFoundPkgs(found, "install"), notFound, mgr)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -76,11 +76,11 @@ func getScriptPaths(pkgs []db.Package) []string {
|
|||
return scripts
|
||||
}
|
||||
|
||||
func flattenFoundPkgs(found map[string][]db.Package) []db.Package {
|
||||
func flattenFoundPkgs(found map[string][]db.Package, verb string) []db.Package {
|
||||
var outPkgs []db.Package
|
||||
for _, pkgs := range found {
|
||||
if len(pkgs) > 1 {
|
||||
choices, err := pkgPrompt(pkgs)
|
||||
choices, err := pkgPrompt(pkgs, verb)
|
||||
if err != nil {
|
||||
log.Fatal("Error prompting for choice of package").Send()
|
||||
}
|
||||
|
|
|
@ -28,6 +28,9 @@ import (
|
|||
"mvdan.cc/sh/v3/syntax"
|
||||
)
|
||||
|
||||
// Pull pulls the provided repositories. If a repo doesn't exist, it will be cloned
|
||||
// and its packages will be written to the DB. If it does exist, it will be pulled.
|
||||
// In this case, only changed packages will be processed.
|
||||
func Pull(ctx context.Context, gdb *genji.DB, repos []types.Repo) error {
|
||||
for _, repo := range repos {
|
||||
repoURL, err := url.Parse(repo.URL)
|
||||
|
|
4
repo.go
4
repo.go
|
@ -122,7 +122,7 @@ func refreshCmd(c *cli.Context) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func pkgPrompt(options []db.Package) ([]db.Package, error) {
|
||||
func pkgPrompt(options []db.Package, verb string) ([]db.Package, error) {
|
||||
names := make([]string, len(options))
|
||||
for i, option := range options {
|
||||
names[i] = option.Repository + "/" + option.Name + " " + option.Version
|
||||
|
@ -130,7 +130,7 @@ func pkgPrompt(options []db.Package) ([]db.Package, error) {
|
|||
|
||||
prompt := &survey.MultiSelect{
|
||||
Options: names,
|
||||
Message: "Choose which package(s) to install",
|
||||
Message: "Choose which package(s) to " + verb,
|
||||
}
|
||||
|
||||
var choices []int
|
||||
|
|
Loading…
Reference in New Issue