api/internal/cmd/cli.go
Peter Kurfer 9a50ce522c
Complete health API
- complete client implementation
- add server part to gRPC server
2020-06-23 14:54:08 +02:00

33 lines
949 B
Go

package cmd
import (
"github.com/spf13/cobra"
"time"
)
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")
cliCmd.AddCommand(endpointsCmd, handlerCmd, healthCmd)
endpointsCmd.AddCommand(getEndpoints)
handlerCmd.AddCommand(getHandlersCmd)
healthCmd.AddCommand(generalHealthCmd)
healthCmd.AddCommand(containerHealthCmd)
}
func ExecuteClientCommand() error {
return cliCmd.Execute()
}