zrok/cmd/zrokloop/main.go

36 lines
878 B
Go
Raw Normal View History

package main
import (
"github.com/michaelquigley/pfxlog"
"github.com/openziti-test-kitchen/zrok/zrokdir"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"os"
"path/filepath"
"strings"
)
func init() {
pfxlog.GlobalInit(logrus.InfoLevel, pfxlog.DefaultOptions().SetTrimPrefix("github.com/openziti-test-kitchen/"))
rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Enable verbose logging")
zrokdir.AddZrokApiEndpointFlag(&apiEndpoint, rootCmd.PersistentFlags())
}
var rootCmd = &cobra.Command{
Use: strings.TrimSuffix(filepath.Base(os.Args[0]), filepath.Ext(os.Args[0])),
Short: "zrok loopback harness",
PersistentPreRun: func(_ *cobra.Command, _ []string) {
if verbose {
logrus.SetLevel(logrus.DebugLevel)
}
},
}
var verbose bool
var apiEndpoint string
func main() {
if err := rootCmd.Execute(); err != nil {
panic(err)
}
}