MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / newPluginListCmd

Function newPluginListCmd

app/cli/cmd/plugins.go:167–204  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

165}
166
167func newPluginListCmd() *cobra.Command {
168 return &cobra.Command{
169 Use: "list",
170 Aliases: []string{"ls"},
171 Short: "List installed plugins",
172 RunE: func(_ *cobra.Command, _ []string) error {
173 result, err := action.NewPluginList(ActionOpts, pluginManager).Run(context.Background())
174 if err != nil {
175 return err
176 }
177
178 if flagOutputFormat == output.FormatJSON {
179 type pluginInfo struct {
180 Name string `json:"name"`
181 Version string `json:"version"`
182 Description string `json:"description"`
183 Path string `json:"path"`
184 }
185
186 var items []pluginInfo
187 for name, plugin := range result.Plugins {
188 items = append(items, pluginInfo{
189 Name: name,
190 Version: plugin.Metadata.Version,
191 Description: plugin.Metadata.Description,
192 Path: plugin.Path,
193 })
194 }
195
196 return output.EncodeJSON(items)
197 }
198
199 pluginListTableOutput(result.Plugins)
200
201 return nil
202 },
203 }
204}
205
206func newPluginDescribeCmd() *cobra.Command {
207 var pluginName string

Callers 1

newPluginCmdFunction · 0.85

Calls 4

NewPluginListFunction · 0.92
EncodeJSONFunction · 0.92
pluginListTableOutputFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected