Skip to content

Commit

Permalink
add checks for existence of /home/ebarajas/.kube folder and for the c…
Browse files Browse the repository at this point in the history
…ount of kubeconfigs
  • Loading branch information
ebarped committed Feb 2, 2023
1 parent fd5729f commit ec0c080
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,13 @@ func rootFunc(cmd *cobra.Command, args []string) {
// we dont have the filename arg, so we scan the $HOME/.kube/ directory
files, err := ioutil.ReadDir(kcRootDir)
if err != nil {
log.Error().Msg(err.Error())
log.Fatal().Msg(err.Error())
}

// check if we have any kubeconfig to list
if len(files) == 0 {
log.Info().Str("path", kcRootDir).Msg("Seems that you dont have any kubeconfig files ...")
os.Exit(0)
}

var listItems []list.Item
Expand Down

0 comments on commit ec0c080

Please sign in to comment.