api/internal/cmd/cli.go
Peter Kurfer 108444e094 Add health API and basic CLI support
- remove plugin API due to incompatibility issues
- add Docker build to GitHub Actions
- add custom container friendly config file
2020-06-15 12:32:18 +02:00

28 lines
845 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(containerHealthCmd)
}