mirror of
https://github.com/aquasecurity/trivy.git
synced 2025-12-22 15:16:33 -08:00
feat(plugin): Add option to update plugin (#1462)
* Add option to update plugin - add plugin update [pluginName] to update - add supporting test * refactor: wrap errors
This commit is contained in:
@@ -90,6 +90,24 @@ func List(c *cli.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Update updates an existing plugin
|
||||
func Update(c *cli.Context) error {
|
||||
if c.NArg() != 1 {
|
||||
cli.ShowSubcommandHelpAndExit(c, 1)
|
||||
}
|
||||
|
||||
if err := initLogger(c); err != nil {
|
||||
return xerrors.Errorf("initialize error: %w", err)
|
||||
}
|
||||
|
||||
pluginName := c.Args().First()
|
||||
if err := plugin.Update(pluginName); err != nil {
|
||||
return xerrors.Errorf("plugin update error: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Run runs the plugin
|
||||
func Run(c *cli.Context) error {
|
||||
if c.NArg() < 1 {
|
||||
|
||||
Reference in New Issue
Block a user