@@ -19,9 +19,9 @@ import (
1919 "fmt"
2020 "os"
2121
22- "github.com/spf13/cobra"
23-
22+ "github.com/redhat-cop/oc-helm/pkg/constants"
2423 "github.com/redhat-cop/oc-helm/pkg/options"
24+ "github.com/spf13/cobra"
2525)
2626
2727func newRootCmd (commandLineOptions * options.CommandLineOption ) (* cobra.Command , error ) {
@@ -34,10 +34,10 @@ func newRootCmd(commandLineOptions *options.CommandLineOption) (*cobra.Command,
3434 SilenceErrors : true ,
3535 }
3636
37- rootCmd .PersistentFlags ().StringVar (& commandLineOptions .ConsoleHostname , "console-hostname" , "" , "OpenShift Console Hostname" )
37+ rootCmd .PersistentFlags ().StringVar (& commandLineOptions .ConsoleHostname , "console-hostname" , os . Getenv ( constants . OPENSHIFT_CONSOLE_HOSTNAME_ENV ) , "OpenShift Console Hostname" )
3838 rootCmd .PersistentFlags ().StringVar (& commandLineOptions .Context , "context" , "" , "Kubernetes Context" )
3939 rootCmd .PersistentFlags ().StringVarP (& commandLineOptions .Namespace , "namespace" , "n" , "" , "Kubernetes namespace" )
40- rootCmd .PersistentFlags ().StringVarP (& commandLineOptions .Token , "token" , "t" , "" , "OpenShift OAuth token" )
40+ rootCmd .PersistentFlags ().StringVarP (& commandLineOptions .Token , "token" , "t" , os . Getenv ( constants . OPENSHIFT_OAUTH_TOKEN_ENV ) , "OpenShift OAuth token" )
4141
4242 rootCmd .AddCommand (
4343 newHistoryCmd (commandLineOptions ),
@@ -56,7 +56,6 @@ func newRootCmd(commandLineOptions *options.CommandLineOption) (*cobra.Command,
5656func Execute () {
5757
5858 commandLineOption := options .NewCommandLineOption ()
59-
6059 rootCmd , _ := newRootCmd (commandLineOption )
6160
6261 if err := rootCmd .Execute (); err != nil {
0 commit comments