Skip to content

Commit

Permalink
adding version command && testing
Browse files Browse the repository at this point in the history
  • Loading branch information
pthomison committed Apr 5, 2024
1 parent 9d79e13 commit 5e046d9
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cmd/k3auto.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,19 @@ var (
MinimalFlag bool
)

// ldflag vars
var (
version = "dev"
commit = "none"
date = "unknown"
)

func init() {
K3AutoCmd.PersistentFlags().StringVarP(&ClusterConfigFileFlag, "cluster-config", "c", "", "Override Cluster Config File")
K3AutoCmd.PersistentFlags().StringVarP(&DeploymentDirectoryFlag, "deployment-directory", "d", "", "Deployment Directory")
K3AutoCmd.PersistentFlags().BoolVarP(&MinimalFlag, "minimal", "m", false, "Only deploy the k3d cluster & flux controllers")

K3AutoCmd.AddCommand(VersionCmd)
K3AutoCmd.AddCommand(CreateCmd)
K3AutoCmd.AddCommand(DeleteCmd)
// K3AutoCmd.AddCommand(UpdateCmd)
Expand Down
47 changes: 47 additions & 0 deletions cmd/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package cmd

import (
"fmt"

"github.com/spf13/cobra"
)

var VersionCmd = &cobra.Command{
Use: "version",
Short: "Implementation Pending; Update the deployments in a cluster",
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("Version: %v\nCommit: %v\nDate: %v\n", version, commit, date)
},
}

// func k3AutoUpdate(cmd *cobra.Command, args []string) {
// ctx := cmd.Context()
// if ctx == nil {
// ctx = context.Background()
// }

// var err error

// // clusterConfig, err := parseConfigFile(ClusterConfigFileFlag)
// // checkError(err)
// // logrus.Info("K3D Config File Loaded: ", ClusterConfigFileFlag)

// if !MinimalFlag {

// logrus.Info("Injecting Default Deployments")
// err = Deploy(ctx, "default", defaults.DefaultDeploymentsFolder, afero.FromIOFS{FS: defaults.DefaultDeployments})
// checkError(err)
// logrus.Info("Default Deployments Injected")

// }

// if DeploymentDirectoryFlag != "" {

// logrus.Info("Injecting Directory Deployments")
// err = Deploy(ctx, "deployments", DeploymentDirectoryFlag, afero.NewOsFs())
// checkError(err)

// logrus.Info("Directory Deployments Injected")

// }
// }

0 comments on commit 5e046d9

Please sign in to comment.