(ctx *cliContext.Context)
| 45 | } |
| 46 | |
| 47 | func (ml *ModelsList) Run(ctx *cliContext.Context) error { |
| 48 | var galleries []config.Gallery |
| 49 | if err := json.Unmarshal([]byte(ml.Galleries), &galleries); err != nil { |
| 50 | xlog.Error("unable to load galleries", "error", err) |
| 51 | } |
| 52 | |
| 53 | systemState, err := system.GetSystemState( |
| 54 | system.WithModelPath(ml.ModelsPath), |
| 55 | system.WithBackendPath(ml.BackendsPath), |
| 56 | ) |
| 57 | if err != nil { |
| 58 | return err |
| 59 | } |
| 60 | models, err := gallery.AvailableGalleryModels(galleries, systemState) |
| 61 | if err != nil { |
| 62 | return err |
| 63 | } |
| 64 | for _, model := range models { |
| 65 | if model.Installed { |
| 66 | fmt.Printf(" * %s@%s (installed)\n", model.Gallery.Name, model.Name) |
| 67 | } else { |
| 68 | fmt.Printf(" - %s@%s\n", model.Gallery.Name, model.Name) |
| 69 | } |
| 70 | } |
| 71 | return nil |
| 72 | } |
| 73 | |
| 74 | func (mi *ModelsInstall) Run(ctx *cliContext.Context) error { |
| 75 | systemState, err := system.GetSystemState( |
nothing calls this directly
no test coverage detected