summaryrefslogtreecommitdiff
path: root/internal/cli/reset
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2022-03-06 12:13:02 +0100
committerValery Piashchynski <[email protected]>2022-03-06 12:13:02 +0100
commit70e4f020afd0352dc52114651f0f65c1965ed399 (patch)
treecc6595214e4ff39600099fb8c6f39e7a3dd560e9 /internal/cli/reset
parent587702be62b65c151d27dc79e62fcbbd11290e6f (diff)
remove config plugin usage from the root
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'internal/cli/reset')
-rw-r--r--internal/cli/reset/command.go9
-rw-r--r--internal/cli/reset/command_test.go4
2 files changed, 8 insertions, 5 deletions
diff --git a/internal/cli/reset/command.go b/internal/cli/reset/command.go
index 1d7dd78c..a0634c31 100644
--- a/internal/cli/reset/command.go
+++ b/internal/cli/reset/command.go
@@ -8,7 +8,6 @@ import (
"github.com/fatih/color"
"github.com/mattn/go-runewidth"
- "github.com/roadrunner-server/config/v2"
"github.com/roadrunner-server/errors"
"github.com/spf13/cobra"
"github.com/vbauerster/mpb/v5"
@@ -18,7 +17,7 @@ import (
var spinnerStyle = []string{"∙∙∙", "●∙∙", "∙●∙", "∙∙●", "∙∙∙"} //nolint:gochecknoglobals
// NewCommand creates `reset` command.
-func NewCommand(cfgPlugin *config.Plugin) *cobra.Command { //nolint:funlen
+func NewCommand(cfgFile *string) *cobra.Command { //nolint:funlen
return &cobra.Command{
Use: "reset",
Short: "Reset workers of all or specific RoadRunner service",
@@ -29,7 +28,11 @@ func NewCommand(cfgPlugin *config.Plugin) *cobra.Command { //nolint:funlen
resetterReset = "resetter.Reset"
)
- client, err := internalRpc.NewClient(cfgPlugin)
+ if cfgFile == nil {
+ return errors.E(op, errors.Str("no configuration file provided"))
+ }
+
+ client, err := internalRpc.NewClient(*cfgFile)
if err != nil {
return err
}
diff --git a/internal/cli/reset/command_test.go b/internal/cli/reset/command_test.go
index 1983cc5c..ca68cb54 100644
--- a/internal/cli/reset/command_test.go
+++ b/internal/cli/reset/command_test.go
@@ -5,12 +5,12 @@ import (
"github.com/roadrunner-server/roadrunner/v2/internal/cli/reset"
- "github.com/roadrunner-server/config/v2"
"github.com/stretchr/testify/assert"
)
func TestCommandProperties(t *testing.T) {
- cmd := reset.NewCommand(&config.Plugin{})
+ path := ""
+ cmd := reset.NewCommand(&path)
assert.Equal(t, "reset", cmd.Use)
assert.NotNil(t, cmd.RunE)