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

Function newPluginDescribeCmd

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

Source from the content-addressed store, hash-verified

204}
205
206func newPluginDescribeCmd() *cobra.Command {
207 var pluginName string
208
209 cmd := &cobra.Command{
210 Use: "describe",
211 Short: "Show detailed information about a plugin",
212 Args: cobra.NoArgs,
213 RunE: func(_ *cobra.Command, _ []string) error {
214 if pluginName == "" {
215 return fmt.Errorf("plugin name is required")
216 }
217
218 result, err := action.NewPluginDescribe(ActionOpts, pluginManager).Run(context.Background(), pluginName)
219 if err != nil {
220 return err
221 }
222
223 if flagOutputFormat == output.FormatJSON {
224 type pluginDetail struct {
225 Name string `json:"name"`
226 Version string `json:"version"`
227 Description string `json:"description"`
228 Path string `json:"path"`
229 Commands []*plugins.PluginCommandInfo `json:"commands"`
230 }
231
232 detail := pluginDetail{
233 Name: result.Plugin.Metadata.Name,
234 Version: result.Plugin.Metadata.Version,
235 Description: result.Plugin.Metadata.Description,
236 Path: result.Plugin.Path,
237 Commands: result.Plugin.Metadata.Commands,
238 }
239
240 return output.EncodeJSON(detail)
241 }
242
243 pluginInfoTableOutput(result.Plugin)
244
245 return nil
246 },
247 }
248
249 cmd.Flags().StringVarP(&pluginName, "name", "", "", "Name of the plugin to describe (required)")
250 cobra.CheckErr(cmd.MarkFlagRequired("name"))
251
252 return cmd
253}
254
255func newPluginInstallCmd() *cobra.Command {
256 var file string

Callers 1

newPluginCmdFunction · 0.85

Calls 4

NewPluginDescribeFunction · 0.92
EncodeJSONFunction · 0.92
pluginInfoTableOutputFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected