2022-09-30 21:12:06 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2022-09-30 21:20:15 +02:00
|
|
|
"github.com/michaelquigley/pfxlog"
|
|
|
|
"github.com/openziti-test-kitchen/zrok/zrokdir"
|
2022-09-30 21:12:06 +02:00
|
|
|
"github.com/sirupsen/logrus"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"os"
|
|
|
|
"path/filepath"
|
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
2022-09-30 21:20:15 +02:00
|
|
|
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())
|
|
|
|
}
|
|
|
|
|
2022-09-30 21:12:06 +02:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
}
|