mirror of https://github.com/status-im/consul.git
commands: move operator autopilot command to separate pkg
This commit is contained in:
parent
c50e43a4ea
commit
bd1b189990
|
@ -28,6 +28,7 @@ import (
|
|||
"github.com/hashicorp/consul/command/members"
|
||||
"github.com/hashicorp/consul/command/monitor"
|
||||
"github.com/hashicorp/consul/command/oper"
|
||||
"github.com/hashicorp/consul/command/operauto"
|
||||
"github.com/hashicorp/consul/command/operraft"
|
||||
"github.com/hashicorp/consul/command/operraftlist"
|
||||
"github.com/hashicorp/consul/command/operraftremove"
|
||||
|
@ -150,12 +151,7 @@ func init() {
|
|||
},
|
||||
|
||||
"operator autopilot": func() (cli.Command, error) {
|
||||
return &OperatorAutopilotCommand{
|
||||
BaseCommand: BaseCommand{
|
||||
Flags: FlagSetNone,
|
||||
UI: ui,
|
||||
},
|
||||
}, nil
|
||||
return operauto.New(), nil
|
||||
},
|
||||
|
||||
"operator autopilot get-config": func() (cli.Command, error) {
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
package command
|
||||
|
||||
import (
|
||||
"github.com/mitchellh/cli"
|
||||
)
|
||||
|
||||
type OperatorAutopilotCommand struct {
|
||||
BaseCommand
|
||||
}
|
||||
|
||||
func (c *OperatorAutopilotCommand) Help() string {
|
||||
c.InitFlagSet()
|
||||
return c.HelpCommand(`
|
||||
Usage: consul operator autopilot <subcommand> [options]
|
||||
|
||||
The Autopilot operator command is used to interact with Consul's Autopilot
|
||||
subsystem. The command can be used to view or modify the current configuration.
|
||||
|
||||
`)
|
||||
}
|
||||
|
||||
func (c *OperatorAutopilotCommand) Synopsis() string {
|
||||
return "Provides tools for modifying Autopilot configuration"
|
||||
}
|
||||
|
||||
func (c *OperatorAutopilotCommand) Run(args []string) int {
|
||||
return cli.RunResultHelp
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
package command
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/mitchellh/cli"
|
||||
)
|
||||
|
||||
func TestOperator_Autopilot_Implements(t *testing.T) {
|
||||
t.Parallel()
|
||||
var _ cli.Command = &OperatorAutopilotCommand{}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package operauto
|
||||
|
||||
import (
|
||||
"github.com/mitchellh/cli"
|
||||
)
|
||||
|
||||
func New() *cmd {
|
||||
return &cmd{}
|
||||
}
|
||||
|
||||
type cmd struct{}
|
||||
|
||||
func (c *cmd) Run(args []string) int {
|
||||
return cli.RunResultHelp
|
||||
}
|
||||
|
||||
func (c *cmd) Synopsis() string {
|
||||
return "Provides tools for modifying Autopilot configuration"
|
||||
}
|
||||
|
||||
func (c *cmd) Help() string {
|
||||
s := `Usage: consul operator autopilot <subcommand> [options]
|
||||
|
||||
The Autopilot operator command is used to interact with Consul's Autopilot
|
||||
subsystem. The command can be used to view or modify the current configuration.`
|
||||
|
||||
return s
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package operauto
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestOperatorAutopilotCommand_noTabs(t *testing.T) {
|
||||
t.Parallel()
|
||||
if strings.ContainsRune(New().Help(), '\t') {
|
||||
t.Fatal("usage has tabs")
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue