(store *entities.Store, kind entities.Kind, app string, force bool, out io.Writer)
| 1490 | } |
| 1491 | |
| 1492 | func installAllFromStore(store *entities.Store, kind entities.Kind, app string, force bool, out io.Writer) error { |
| 1493 | items, err := store.All() |
| 1494 | if err != nil { |
| 1495 | return err |
| 1496 | } |
| 1497 | if len(items) == 0 { |
| 1498 | fmt.Fprintf(out, "No %ss in local store to install\n", kind) |
| 1499 | return nil |
| 1500 | } |
| 1501 | installed := 0 |
| 1502 | skipped := 0 |
| 1503 | for _, e := range items { |
| 1504 | if !force && isAlreadyInstalled(e.Name, kind, app) { |
| 1505 | skipped++ |
| 1506 | continue |
| 1507 | } |
| 1508 | dest, err := entities.InstallToApp(e, kind, app) |
| 1509 | if err != nil { |
| 1510 | fmt.Fprintf(out, " Error installing %s: %v\n", e.Name, err) |
| 1511 | continue |
| 1512 | } |
| 1513 | fmt.Fprintf(out, " Installed %s to %s\n", e.Name, dest) |
| 1514 | installed++ |
| 1515 | } |
| 1516 | msg := fmt.Sprintf("\nInstalled %d %s(s) to %s", installed, kind, app) |
| 1517 | if skipped > 0 { |
| 1518 | msg += fmt.Sprintf(" (skipped %d already installed)", skipped) |
| 1519 | } |
| 1520 | fmt.Fprintln(out, msg) |
| 1521 | return nil |
| 1522 | } |
| 1523 | |
| 1524 | // --- install from local directory ------------------------------------------ |
| 1525 |
no test coverage detected