(state *globalState)
| 23 | } |
| 24 | |
| 25 | func (a *App) metadataRefreshCommand(state *globalState) *cobra.Command { |
| 26 | return &cobra.Command{ |
| 27 | Use: "refresh", |
| 28 | Short: "Refresh metadata index from configured repositories", |
| 29 | Args: cobra.NoArgs, |
| 30 | RunE: func(cmd *cobra.Command, args []string) error { |
| 31 | out := cmd.OutOrStdout() |
| 32 | store := metadata.NewStore(state.storePath) |
| 33 | svc := metadata.NewService(store) |
| 34 | |
| 35 | summary, err := svc.RefreshAll(context.Background()) |
| 36 | if err != nil { |
| 37 | return fmt.Errorf("refresh failed: %w", err) |
| 38 | } |
| 39 | fmt.Fprintf(out, "✓ Refreshed metadata\n") |
| 40 | fmt.Fprintf(out, " Sources scanned: %d\n", summary.SourcesScanned) |
| 41 | fmt.Fprintf(out, " Items indexed: %d\n", summary.ItemsAdded) |
| 42 | if len(summary.FailedSources) > 0 { |
| 43 | fmt.Fprintf(out, " Failed sources: %d\n", len(summary.FailedSources)) |
| 44 | for _, f := range summary.FailedSources { |
| 45 | fmt.Fprintf(out, " - %s\n", f) |
| 46 | } |
| 47 | } |
| 48 | return nil |
| 49 | }, |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | func (a *App) metadataSearchCommand(state *globalState) *cobra.Command { |
| 54 | var kindFilter string |
no test coverage detected