Add enable/disable/reset commands

This commit is contained in:
Felipe M 2025-07-09 14:01:23 +02:00
parent fd6e4a4513
commit 1ea8f2b38a
No known key found for this signature in database
GPG key ID: 52E5D65FCF99808A
11 changed files with 221 additions and 163 deletions

23
enable.go Normal file
View file

@ -0,0 +1,23 @@
package pluginctl
import (
"context"
"fmt"
"log"
"github.com/mattermost/mattermost/server/public/model"
)
func RunEnableCommand(args []string, pluginPath string) error {
return runPluginCommand(args, pluginPath, enablePlugin)
}
func enablePlugin(ctx context.Context, client *model.Client4, pluginID string) error {
log.Print("Enabling plugin.")
_, err := client.EnablePlugin(ctx, pluginID)
if err != nil {
return fmt.Errorf("failed to enable plugin: %w", err)
}
return nil
}