mirror of
https://github.com/openziti/ziti.git
synced 2026-10-12 15:28:05 +00:00
Allow controller and router to be run from ziti
This commit is contained in:
@@ -11,6 +11,9 @@
|
||||
* The adhoc, ping and playbook commands have been removed. These were ansible and vagrant commands that were not widely used.
|
||||
* Make the art command hidden, doesn't need to be removed, leave it as an easter egg
|
||||
* Move ziti ps command under ziti agent. Remove all ziti ps subcommands, as they already exist as ziti agent subcommands
|
||||
* Add `ziti controller` and `ziti router` commands
|
||||
* They should work exactly the same as `ziti-controller` and `ziti router`
|
||||
* The standalone binaries for `ziti-controller` and `ziti-router` are deprecated and will be removed in a future release
|
||||
|
||||
# Release 0.26.11
|
||||
|
||||
|
||||
+6
-2
@@ -28,7 +28,9 @@ import (
|
||||
"github.com/openziti/ziti/ziti/cmd/templates"
|
||||
"github.com/openziti/ziti/ziti/cmd/tutorial"
|
||||
c "github.com/openziti/ziti/ziti/constants"
|
||||
"github.com/openziti/ziti/ziti/controller"
|
||||
"github.com/openziti/ziti/ziti/internal/log"
|
||||
"github.com/openziti/ziti/ziti/router"
|
||||
"github.com/openziti/ziti/ziti/util"
|
||||
"io"
|
||||
"os"
|
||||
@@ -121,7 +123,8 @@ func NewCmdRoot(in io.Reader, out, err io.Writer, cmd *cobra.Command) *cobra.Com
|
||||
|
||||
initCommands := NewCmdInit(out, err)
|
||||
createCommands := NewCmdCreate(out, err)
|
||||
executeCommands := NewCmdExecute(out, err)
|
||||
controllerCmd := controller.NewRunCmd()
|
||||
routerCmd := router.NewRunCmd()
|
||||
agentCommands := agentcli.NewAgentCmd(p)
|
||||
pkiCommands := NewCmdPKI(out, err)
|
||||
fabricCommand := fabric.NewFabricCmd(p)
|
||||
@@ -153,8 +156,9 @@ func NewCmdRoot(in io.Reader, out, err io.Writer, cmd *cobra.Command) *cobra.Com
|
||||
{
|
||||
Message: "Executing Ziti components:",
|
||||
Commands: []*cobra.Command{
|
||||
executeCommands,
|
||||
agentCommands,
|
||||
controllerCmd,
|
||||
routerCmd,
|
||||
pkiCommands,
|
||||
unwrapIdentityFileCommand,
|
||||
},
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
/*
|
||||
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 cmd
|
||||
|
||||
import (
|
||||
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
|
||||
"github.com/openziti/ziti/ziti/cmd/templates"
|
||||
"io"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// ExecuteOptions contains the command line options
|
||||
type ExecuteOptions struct {
|
||||
CommonOptions
|
||||
|
||||
Flags ExecuteFlags
|
||||
|
||||
DisableImport bool
|
||||
OutDir string
|
||||
}
|
||||
|
||||
type ExecuteFlags struct {
|
||||
Identity string
|
||||
}
|
||||
|
||||
var (
|
||||
executeLong = templates.LongDesc(`
|
||||
Executes a component.
|
||||
`)
|
||||
)
|
||||
|
||||
// NewCmdExecute Executes a command object for the "Execute" command
|
||||
func NewCmdExecute(out io.Writer, errOut io.Writer) *cobra.Command {
|
||||
options := &ExecuteOptions{
|
||||
CommonOptions: CommonOptions{
|
||||
Out: out,
|
||||
Err: errOut,
|
||||
},
|
||||
}
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "run",
|
||||
Short: "Execute a Ziti component/app",
|
||||
Long: executeLong,
|
||||
Aliases: []string{},
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
options.Cmd = cmd
|
||||
options.Args = args
|
||||
err := options.Run()
|
||||
cmdhelper.CheckErr(err)
|
||||
},
|
||||
}
|
||||
|
||||
cmd.AddCommand(NewCmdExecuteController(out, errOut))
|
||||
|
||||
options.addExecuteFlags(cmd)
|
||||
return cmd
|
||||
}
|
||||
|
||||
func (options *ExecuteOptions) addExecuteFlags(cmd *cobra.Command) {
|
||||
cmd.Flags().StringVarP(&options.Flags.Identity, "identity", "", "", "Which identity to use.")
|
||||
}
|
||||
|
||||
// Run implements this command
|
||||
func (o *ExecuteOptions) Run() error {
|
||||
return o.Cmd.Help()
|
||||
}
|
||||
@@ -1,112 +0,0 @@
|
||||
/*
|
||||
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 cmd
|
||||
|
||||
import (
|
||||
cmdhelper "github.com/openziti/ziti/ziti/cmd/helpers"
|
||||
"github.com/openziti/ziti/ziti/cmd/templates"
|
||||
c "github.com/openziti/ziti/ziti/constants"
|
||||
"github.com/openziti/ziti/ziti/util"
|
||||
"io"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
var (
|
||||
executeControllerLong = templates.LongDesc(`
|
||||
Executes the ziti-controller component
|
||||
`)
|
||||
|
||||
executeControllerExample = templates.Examples(`
|
||||
# Execute the ziti-controller component
|
||||
ziti execute ziti-controller
|
||||
|
||||
`)
|
||||
)
|
||||
|
||||
// ExecuteControllerOptions the options for the create spring command
|
||||
type ExecuteControllerOptions struct {
|
||||
ExecuteOptions
|
||||
|
||||
CtrlListener string
|
||||
}
|
||||
|
||||
// NewCmdExecuteController creates a command object for the "create" command
|
||||
func NewCmdExecuteController(out io.Writer, errOut io.Writer) *cobra.Command {
|
||||
options := &ExecuteControllerOptions{
|
||||
ExecuteOptions: ExecuteOptions{
|
||||
CommonOptions: CommonOptions{
|
||||
Out: out,
|
||||
Err: errOut,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "controller",
|
||||
Short: "'Execute the ziti-controller component'",
|
||||
Aliases: []string{"c", "ctrl"},
|
||||
Long: executeControllerLong,
|
||||
Example: executeControllerExample,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
options.Cmd = cmd
|
||||
options.Args = args
|
||||
err := options.Run()
|
||||
cmdhelper.CheckErr(err)
|
||||
},
|
||||
}
|
||||
|
||||
cmd.PersistentFlags().BoolVarP(&cliAgentEnabled, "cliagent", "a", false, "Enable CLI Agent (use in dev only)")
|
||||
|
||||
options.AddCommonFlags(cmd)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
// Run implements the command
|
||||
func (o *ExecuteControllerOptions) Run() error {
|
||||
|
||||
viper := viper.New()
|
||||
viper.SetConfigType("json")
|
||||
viper.SetConfigName(c.CONFIGFILENAME)
|
||||
zitiConfigDir, err := util.ZitiAppConfigDir(c.ZITI)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
viper.AddConfigPath(zitiConfigDir)
|
||||
err = viper.ReadInConfig()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
zitiControllerConfigDir, err := util.ZitiAppConfigDir(c.ZITI_CONTROLLER)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
zitiControllerConfigFileName := filepath.Join(zitiControllerConfigDir, c.CONFIGFILENAME) + ".yml"
|
||||
|
||||
err = o.startCommandFromDir(viper.GetString("bin"), c.ZITI_CONTROLLER, "run", zitiControllerConfigFileName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -26,15 +26,13 @@ import (
|
||||
"go.etcd.io/bbolt"
|
||||
)
|
||||
|
||||
func init() {
|
||||
root.AddCommand(deleteSessionsCmd)
|
||||
}
|
||||
|
||||
var deleteSessionsCmd = &cobra.Command{
|
||||
Use: "delete-sessions <config>",
|
||||
Short: "Delete all API Sessions and Edge Sessions, controller must be shutdown",
|
||||
Args: cobra.ExactArgs(1),
|
||||
Run: deleteSessions,
|
||||
func NewDeleteSessionsCmd() *cobra.Command {
|
||||
return &cobra.Command{
|
||||
Use: "delete-sessions <config>",
|
||||
Short: "Delete all API Sessions and Edge Sessions, controller must be shutdown",
|
||||
Args: cobra.ExactArgs(1),
|
||||
Run: deleteSessions,
|
||||
}
|
||||
}
|
||||
|
||||
const (
|
||||
|
||||
+34
-28
@@ -27,37 +27,43 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func init() {
|
||||
root.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Enable verbose logging")
|
||||
root.PersistentFlags().BoolVarP(&cliAgentEnabled, "cliagent", "a", true, "Enable/disabled CLI Agent (enabled by default)")
|
||||
root.PersistentFlags().StringVar(&cliAgentAddr, "cli-agent-addr", "", "Specify where CLI Agent should list (ex: unix:/tmp/myfile.sock or tcp:127.0.0.1:10001)")
|
||||
root.PersistentFlags().StringVar(&logFormatter, "log-formatter", "", "Specify log formatter [json|pfxlog|text]")
|
||||
root.PersistentFlags().BoolVar(&syncRaftToDb, "sync-raft-to-db", false, "Sync the current database state to raft as a snapshot. Use when moving an existing controller to run in HA/Raft")
|
||||
func NewControllerCmd() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "ziti-controller",
|
||||
Short: "Ziti Fabric Controller",
|
||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
||||
if verbose {
|
||||
logrus.SetLevel(logrus.DebugLevel)
|
||||
}
|
||||
|
||||
edgeSubCmd.AddCommands(root, version.GetCmdBuildInfo())
|
||||
}
|
||||
switch logFormatter {
|
||||
case "pfxlog":
|
||||
pfxlog.SetFormatter(pfxlog.NewFormatter(pfxlog.DefaultOptions().SetTrimPrefix("github.com/openziti/").StartingToday()))
|
||||
case "json":
|
||||
pfxlog.SetFormatter(&logrus.JSONFormatter{TimestampFormat: "2006-01-02T15:04:05.000Z"})
|
||||
case "text":
|
||||
pfxlog.SetFormatter(&logrus.TextFormatter{})
|
||||
default:
|
||||
// let logrus do its own thing
|
||||
}
|
||||
util.LogReleaseVersionCheck(constants.ZITI_CONTROLLER)
|
||||
|
||||
var root = &cobra.Command{
|
||||
Use: "ziti-controller",
|
||||
Short: "Ziti Fabric Controller",
|
||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
||||
if verbose {
|
||||
logrus.SetLevel(logrus.DebugLevel)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
switch logFormatter {
|
||||
case "pfxlog":
|
||||
pfxlog.SetFormatter(pfxlog.NewFormatter(pfxlog.DefaultOptions().SetTrimPrefix("github.com/openziti/").StartingToday()))
|
||||
case "json":
|
||||
pfxlog.SetFormatter(&logrus.JSONFormatter{TimestampFormat: "2006-01-02T15:04:05.000Z"})
|
||||
case "text":
|
||||
pfxlog.SetFormatter(&logrus.TextFormatter{})
|
||||
default:
|
||||
// let logrus do its own thing
|
||||
}
|
||||
util.LogReleaseVersionCheck(constants.ZITI_CONTROLLER)
|
||||
cmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Enable verbose logging")
|
||||
cmd.PersistentFlags().BoolVarP(&cliAgentEnabled, "cliagent", "a", true, "Enable/disabled CLI Agent (enabled by default)")
|
||||
cmd.PersistentFlags().StringVar(&cliAgentAddr, "cli-agent-addr", "", "Specify where CLI Agent should list (ex: unix:/tmp/myfile.sock or tcp:127.0.0.1:10001)")
|
||||
cmd.PersistentFlags().StringVar(&logFormatter, "log-formatter", "", "Specify log formatter [json|pfxlog|text]")
|
||||
cmd.PersistentFlags().BoolVar(&syncRaftToDb, "sync-raft-to-db", false, "Sync the current database state to raft as a snapshot. Use when moving an existing controller to run in HA/Raft")
|
||||
|
||||
},
|
||||
cmd.AddCommand(NewRunCmd())
|
||||
cmd.AddCommand(NewDeleteSessionsCmd())
|
||||
cmd.AddCommand(NewVersionCmd())
|
||||
|
||||
edgeSubCmd.AddCommands(cmd, version.GetCmdBuildInfo())
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
var verbose bool
|
||||
@@ -67,7 +73,7 @@ var logFormatter string
|
||||
var syncRaftToDb bool
|
||||
|
||||
func Execute() {
|
||||
if err := root.Execute(); err != nil {
|
||||
if err := NewControllerCmd().Execute(); err != nil {
|
||||
fmt.Printf("error: %s\n", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,15 +32,13 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func init() {
|
||||
root.AddCommand(runCmd)
|
||||
}
|
||||
|
||||
var runCmd = &cobra.Command{
|
||||
Use: "run <config>",
|
||||
Short: "Run controller configuration",
|
||||
Args: cobra.ExactArgs(1),
|
||||
Run: run,
|
||||
func NewRunCmd() *cobra.Command {
|
||||
return &cobra.Command{
|
||||
Use: "run <config>",
|
||||
Short: "Run controller configuration",
|
||||
Args: cobra.ExactArgs(1),
|
||||
Run: run,
|
||||
}
|
||||
}
|
||||
|
||||
func run(cmd *cobra.Command, args []string) {
|
||||
|
||||
@@ -22,14 +22,12 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func init() {
|
||||
root.AddCommand(versionCmd)
|
||||
}
|
||||
|
||||
var versionCmd = &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Show component version",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Println(version.GetBuildMetadata(verbose))
|
||||
},
|
||||
func NewVersionCmd() *cobra.Command {
|
||||
return &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Show component version",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Println(version.GetBuildMetadata(verbose))
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,19 +29,20 @@ var jwtPath *string
|
||||
var engine *string
|
||||
var keyAlg config.KeyAlgVar
|
||||
|
||||
func init() {
|
||||
func NewEnrollGwCmd() *cobra.Command {
|
||||
var enrollEdgeRouterCmd = &cobra.Command{
|
||||
Use: "enroll <config>",
|
||||
Short: "Enroll a router as an edge router",
|
||||
Args: cobra.ExactArgs(1),
|
||||
Run: enrollGw,
|
||||
}
|
||||
|
||||
jwtPath = enrollEdgeRouterCmd.Flags().StringP("jwt", "j", "", "The path to a JWT file")
|
||||
engine = enrollEdgeRouterCmd.Flags().StringP("engine", "e", "", "An engine")
|
||||
keyAlg.Set("RSA") // set default
|
||||
enrollEdgeRouterCmd.Flags().VarP(&keyAlg, "keyAlg", "a", "Crypto algorithm to use when generating private key")
|
||||
root.AddCommand(enrollEdgeRouterCmd)
|
||||
}
|
||||
|
||||
var enrollEdgeRouterCmd = &cobra.Command{
|
||||
Use: "enroll <config>",
|
||||
Short: "Enroll a router as an edge router",
|
||||
Args: cobra.ExactArgs(1),
|
||||
Run: enrollGw,
|
||||
return enrollEdgeRouterCmd
|
||||
}
|
||||
|
||||
func enrollGw(cmd *cobra.Command, args []string) {
|
||||
|
||||
+33
-27
@@ -25,35 +25,41 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func init() {
|
||||
root.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Enable verbose logging")
|
||||
root.PersistentFlags().StringVar(&logFormatter, "log-formatter", "", "Specify log formatter [json|pfxlog|text]")
|
||||
root.PersistentFlags().BoolVar(&cliAgentEnabled, "cli-agent", true, "Enable/disable CLI Agent (enabled by default)")
|
||||
root.PersistentFlags().StringVar(&cliAgentAddr, "cli-agent-addr", "", "Specify where CLI Agent should list (ex: unix:/tmp/myfile.sock or tcp:127.0.0.1:10001)")
|
||||
root.PersistentFlags().BoolVar(&enableDebugOps, "debug-ops", false, "Enable/disable debug agent operations (disabled by default)")
|
||||
}
|
||||
func NewRouterCmd() *cobra.Command {
|
||||
var routerCmd = &cobra.Command{
|
||||
Use: "ziti-router",
|
||||
Short: "Ziti Fabric Router",
|
||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
||||
if verbose {
|
||||
logrus.SetLevel(logrus.DebugLevel)
|
||||
}
|
||||
|
||||
var root = &cobra.Command{
|
||||
Use: "ziti-router",
|
||||
Short: "Ziti Fabric Router",
|
||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
||||
if verbose {
|
||||
logrus.SetLevel(logrus.DebugLevel)
|
||||
}
|
||||
switch logFormatter {
|
||||
case "pfxlog":
|
||||
pfxlog.SetFormatter(pfxlog.NewFormatter(pfxlog.DefaultOptions().SetTrimPrefix("github.com/openziti/").StartingToday()))
|
||||
case "json":
|
||||
pfxlog.SetFormatter(&logrus.JSONFormatter{TimestampFormat: "2006-01-02T15:04:05.000Z"})
|
||||
case "text":
|
||||
pfxlog.SetFormatter(&logrus.TextFormatter{})
|
||||
default:
|
||||
// let logrus do its own thing
|
||||
}
|
||||
util.LogReleaseVersionCheck(constants.ZITI_ROUTER)
|
||||
|
||||
switch logFormatter {
|
||||
case "pfxlog":
|
||||
pfxlog.SetFormatter(pfxlog.NewFormatter(pfxlog.DefaultOptions().SetTrimPrefix("github.com/openziti/").StartingToday()))
|
||||
case "json":
|
||||
pfxlog.SetFormatter(&logrus.JSONFormatter{TimestampFormat: "2006-01-02T15:04:05.000Z"})
|
||||
case "text":
|
||||
pfxlog.SetFormatter(&logrus.TextFormatter{})
|
||||
default:
|
||||
// let logrus do its own thing
|
||||
}
|
||||
util.LogReleaseVersionCheck(constants.ZITI_ROUTER)
|
||||
},
|
||||
}
|
||||
|
||||
},
|
||||
routerCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Enable verbose logging")
|
||||
routerCmd.PersistentFlags().StringVar(&logFormatter, "log-formatter", "", "Specify log formatter [json|pfxlog|text]")
|
||||
routerCmd.PersistentFlags().BoolVar(&cliAgentEnabled, "cli-agent", true, "Enable/disable CLI Agent (enabled by default)")
|
||||
routerCmd.PersistentFlags().StringVar(&cliAgentAddr, "cli-agent-addr", "", "Specify where CLI Agent should list (ex: unix:/tmp/myfile.sock or tcp:127.0.0.1:10001)")
|
||||
routerCmd.PersistentFlags().BoolVar(&enableDebugOps, "debug-ops", false, "Enable/disable debug agent operations (disabled by default)")
|
||||
|
||||
routerCmd.AddCommand(NewRunCmd())
|
||||
routerCmd.AddCommand(NewEnrollGwCmd())
|
||||
routerCmd.AddCommand(NewVersionCmd())
|
||||
|
||||
return routerCmd
|
||||
}
|
||||
|
||||
var verbose bool
|
||||
@@ -63,7 +69,7 @@ var enableDebugOps bool
|
||||
var cliAgentAddr string
|
||||
|
||||
func Execute() {
|
||||
if err := root.Execute(); err != nil {
|
||||
if err := NewRouterCmd().Execute(); err != nil {
|
||||
fmt.Printf("error: %s\n", err)
|
||||
}
|
||||
}
|
||||
|
||||
+8
-9
@@ -39,19 +39,18 @@ import (
|
||||
"syscall"
|
||||
)
|
||||
|
||||
var forceEnrollmentExtension *bool
|
||||
func NewRunCmd() *cobra.Command {
|
||||
var runCmd = &cobra.Command{
|
||||
Use: "run <config>",
|
||||
Short: "Run router configuration",
|
||||
Args: cobra.ExactArgs(1),
|
||||
Run: run,
|
||||
}
|
||||
|
||||
func init() {
|
||||
//flags are added to an internal map and read later on, see getFlags()
|
||||
runCmd.Flags().BoolP("extend", "e", false, "force the router on startup to extend enrollment certificates")
|
||||
root.AddCommand(runCmd)
|
||||
}
|
||||
|
||||
var runCmd = &cobra.Command{
|
||||
Use: "run <config>",
|
||||
Short: "Run router configuration",
|
||||
Args: cobra.ExactArgs(1),
|
||||
Run: run,
|
||||
return runCmd
|
||||
}
|
||||
|
||||
func run(cmd *cobra.Command, args []string) {
|
||||
|
||||
+8
-10
@@ -22,14 +22,12 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func init() {
|
||||
root.AddCommand(versionCmd)
|
||||
}
|
||||
|
||||
var versionCmd = &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Show component version",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Println(version.GetBuildMetadata(verbose))
|
||||
},
|
||||
func NewVersionCmd() *cobra.Command {
|
||||
return &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Show component version",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Println(version.GetBuildMetadata(verbose))
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user