Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
Improved view-local command
Browse files Browse the repository at this point in the history
  • Loading branch information
Matteo Baiguini SBT committed Jan 7, 2020
1 parent 4e928d6 commit 4199511
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion commands/view/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bygui86/konf/commons"
"bygui86/konf/kubeconfig"
"bygui86/konf/logger"
"bygui86/konf/utils"

"github.com/urfave/cli"
)
Expand All @@ -28,7 +29,7 @@ func viewLocal(ctx *cli.Context) error {
if kubeConfig != "" {
logger.SugaredLogger.Infof("πŸ’» Local Kubernetes context: '%s'", kubeConfig)
} else {
logger.SugaredLogger.Infof("πŸ’» No local Kubernetes context set")
logger.SugaredLogger.Infof("πŸ’» No local Kubernetes context set or default to '%s/%s'", utils.GetHomeDirOrExit("view-local"), commons.CustomKubeConfigPathDefault)
}

logger.Logger.Info("")
Expand All @@ -40,6 +41,7 @@ func viewGlobal(ctx *cli.Context) error {
logger.Logger.Debug("πŸ› Executing VIEW-GLOBAL command")
logger.Logger.Debug("")

logger.Logger.Debug("πŸ› Get Kubernetes configuration file path")
kubeConfigFilePath := ctx.String(commons.CustomKubeConfigFlagName)
logger.SugaredLogger.Infof("πŸ“– Load Kubernetes configuration from '%s'", kubeConfigFilePath)
kubeConfig := kubeconfig.Load(kubeConfigFilePath)
Expand Down
4 changes: 3 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package main

import "bygui86/konf/application"
import (
"bygui86/konf/application"
)

func main() {
application.Create().Start()
Expand Down
4 changes: 2 additions & 2 deletions utils/os.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ func CheckIfFileExist(filepath string) error {
return nil
}

func GetHomeDirOrExit(command string) string {
func GetHomeDirOrExit(methodCaller string) string {
logger.Logger.Debug("πŸ› Get HOME path")
home, homeErr := GetHomeDir()
if homeErr != nil {
logger.SugaredLogger.Errorf("❌ Error creating '%s' command - Error getting HOME environment variable: %s", command, homeErr.Error())
logger.SugaredLogger.Errorf("❌ Error creating '%s' methodCaller - Error getting HOME environment variable: '%s'", methodCaller, homeErr.Error())
os.Exit(3)
}
logger.SugaredLogger.Debugf("πŸ› HOME path: '%s'", home)
Expand Down

0 comments on commit 4199511

Please sign in to comment.