2020-05-03 08:18:28 +00:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
2020-12-26 13:11:49 +00:00
|
|
|
|
|
|
|
"github.com/spf13/cobra"
|
2020-05-03 08:18:28 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
cliCmd = &cobra.Command{
|
|
|
|
Use: "",
|
|
|
|
Short: "IMCTL is the CLI app to interact with an INetMock server",
|
|
|
|
}
|
|
|
|
|
|
|
|
inetMockSocketPath string
|
|
|
|
outputFormat string
|
|
|
|
grpcTimeout time.Duration
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
cliCmd.PersistentFlags().StringVar(&inetMockSocketPath, "socket-path", "./inetmock.sock", "Path to the INetMock socket file")
|
|
|
|
cliCmd.PersistentFlags().StringVarP(&outputFormat, "format", "f", "table", "Output format to use. Possible values: table, json, yaml")
|
|
|
|
cliCmd.PersistentFlags().DurationVar(&grpcTimeout, "grpc-timeout", 5*time.Second, "Timeout to connect to the gRPC API")
|
|
|
|
|
2020-06-15 10:04:08 +00:00
|
|
|
cliCmd.AddCommand(endpointsCmd, handlerCmd, healthCmd)
|
2020-05-03 08:18:28 +00:00
|
|
|
endpointsCmd.AddCommand(getEndpoints)
|
|
|
|
handlerCmd.AddCommand(getHandlersCmd)
|
2020-06-23 12:54:08 +00:00
|
|
|
healthCmd.AddCommand(generalHealthCmd)
|
2020-06-15 10:04:08 +00:00
|
|
|
healthCmd.AddCommand(containerHealthCmd)
|
2020-05-03 08:18:28 +00:00
|
|
|
}
|
2020-06-23 12:54:08 +00:00
|
|
|
|
|
|
|
func ExecuteClientCommand() error {
|
|
|
|
return cliCmd.Execute()
|
|
|
|
}
|