()
| 165 | } |
| 166 | |
| 167 | func 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 | |
| 206 | func newPluginDescribeCmd() *cobra.Command { |
| 207 | var pluginName string |
no test coverage detected