Add version cli command
This commit is contained in:
@@ -302,6 +302,7 @@ func (r *runner) Run(ctx context.Context) error {
|
||||
serveCmd,
|
||||
upgradeCmd,
|
||||
provisionCmd,
|
||||
cli.VersionCommand(),
|
||||
)
|
||||
|
||||
// Register CLI commands from all parts (when compatible)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"github.com/cortezaproject/corteza-server/pkg/version"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
@@ -27,6 +28,11 @@ var (
|
||||
Use: "provision",
|
||||
Short: "Provision tasks",
|
||||
}
|
||||
|
||||
versionCommand = cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Version",
|
||||
}
|
||||
)
|
||||
|
||||
// RootCommand creates root command with a simple persistent-pre-run callback
|
||||
@@ -80,3 +86,14 @@ func ProvisionCommand(cffn func() error) *cobra.Command {
|
||||
|
||||
return &cfCmd
|
||||
}
|
||||
|
||||
func VersionCommand() *cobra.Command {
|
||||
// Make a copies
|
||||
var cfCmd = versionCommand
|
||||
|
||||
cfCmd.Run = func(cmd *cobra.Command, args []string) {
|
||||
cmd.Println(version.Version)
|
||||
}
|
||||
|
||||
return &cfCmd
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user