mirror of
https://github.com/hanzozt/zt.git
synced 2026-11-03 05:01:58 +00:00
Every variable the code reads or sets is now ZT_* with the same suffix, with no aliases for the old names. User-facing text, default CSR fields and error messages follow, as do the identifiers on the lines that changed. Three names keep their spelling because another program owns them: the C tunneler reads ZITI_LOG and ZITI_TIME_FORMAT, and the Go SDK reads ZITI_TRACE_ENABLED. Co-authored-by: Hanzo Dev <[email protected]>
48 lines
1.1 KiB
Go
48 lines
1.1 KiB
Go
/*
|
|
Copyright NetFoundry Inc.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
https://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
package subcmd
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"path/filepath"
|
|
|
|
"github.com/sirupsen/logrus"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func init() {
|
|
Root.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Enable verbose logging")
|
|
}
|
|
|
|
var Root = &cobra.Command{
|
|
Use: filepath.Base(os.Args[0]),
|
|
Short: "ZT Traffic Test Toolbox",
|
|
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
|
if verbose {
|
|
logrus.SetLevel(logrus.DebugLevel)
|
|
}
|
|
},
|
|
}
|
|
var verbose bool
|
|
|
|
func Execute() {
|
|
if err := Root.Execute(); err != nil {
|
|
println(fmt.Errorf("error: %s", err))
|
|
}
|
|
}
|