Clean up how settings are handled
This commit is contained in:
parent
d26c6c76a1
commit
b672281dcf
|
@ -5,10 +5,12 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/ian-howell/airshipadm/pkg/settings"
|
"github.com/ian-howell/airshipadm/pkg/environment"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var settings environment.AirshipADMSettings
|
||||||
|
|
||||||
// NewRootCmd creates the root `airshipadm` command. All other commands are
|
// NewRootCmd creates the root `airshipadm` command. All other commands are
|
||||||
// subcommands branching from this one
|
// subcommands branching from this one
|
||||||
func NewRootCmd(out io.Writer) *cobra.Command {
|
func NewRootCmd(out io.Writer) *cobra.Command {
|
||||||
|
@ -23,7 +25,7 @@ func NewRootCmd(out io.Writer) *cobra.Command {
|
||||||
// Compound commands
|
// Compound commands
|
||||||
rootCmd.AddCommand(NewWorkflowCommand())
|
rootCmd.AddCommand(NewWorkflowCommand())
|
||||||
|
|
||||||
rootCmd.PersistentFlags().StringVar(&settings.Settings.KubeConfigFilePath, "kubeconfig", "", "path to kubeconfig")
|
rootCmd.PersistentFlags().StringVar(&settings.KubeConfigFilePath, "kubeconfig", "", "path to kubeconfig")
|
||||||
|
|
||||||
return rootCmd
|
return rootCmd
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
kube "github.com/ian-howell/airshipadm/pkg/kube"
|
kube "github.com/ian-howell/airshipadm/pkg/kube"
|
||||||
"github.com/ian-howell/airshipadm/pkg/settings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const versionLong = `Show the versions for the airshipadm tool and the supporting tools.
|
const versionLong = `Show the versions for the airshipadm tool and the supporting tools.
|
||||||
|
@ -29,7 +28,7 @@ func NewVersionCommand(out io.Writer) *cobra.Command {
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
fmt.Fprintf(out, "%-10s: %s\n", "airshipadm", airshipadmVersion())
|
fmt.Fprintf(out, "%-10s: %s\n", "airshipadm", airshipadmVersion())
|
||||||
fmt.Fprintf(out, "%-10s: %s\n", "golang", runtime.Version())
|
fmt.Fprintf(out, "%-10s: %s\n", "golang", runtime.Version())
|
||||||
fmt.Fprintf(out, "%-10s: %s\n", "kubernetes", kubeVersion(settings.Settings.KubeConfigFilePath))
|
fmt.Fprintf(out, "%-10s: %s\n", "kubernetes", kubeVersion(settings.KubeConfigFilePath))
|
||||||
fmt.Fprintf(out, "%-10s: %s\n", "helm", helmVersion())
|
fmt.Fprintf(out, "%-10s: %s\n", "helm", helmVersion())
|
||||||
fmt.Fprintf(out, "%-10s: %s\n", "argo", argoVersion())
|
fmt.Fprintf(out, "%-10s: %s\n", "argo", argoVersion())
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
package settings
|
package environment
|
||||||
|
|
||||||
// Settings contains all of the configuration required by airshipadm
|
|
||||||
var Settings = new(AirshipADMSettings)
|
|
||||||
|
|
||||||
// AirshipADMSettings is a container for all of the settings needed by airshipadm
|
// AirshipADMSettings is a container for all of the settings needed by airshipadm
|
||||||
type AirshipADMSettings struct {
|
type AirshipADMSettings struct {
|
Loading…
Reference in New Issue