Add enable/disable/reset commands
This commit is contained in:
parent
fd6e4a4513
commit
1ea8f2b38a
11 changed files with 221 additions and 163 deletions
23
enable.go
Normal file
23
enable.go
Normal 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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue