diff --git a/cmd/client/main.go b/cmd/client/main.go index 67d9841..e3caddd 100644 --- a/cmd/client/main.go +++ b/cmd/client/main.go @@ -3,6 +3,7 @@ package main import ( "context" "os" + "reflect" "github.com/adrg/xdg" "github.com/gookit/color" @@ -134,6 +135,14 @@ func addContextCmd(cfg *Config, root *cobra.Command) { fatalf("Fail to update config: %v", err) } + // Print values from current context. + fields := reflect.VisibleFields(reflect.TypeOf(cfg.Context)) + v := reflect.ValueOf(cfg.Context) + for _, field := range fields { + color.Bold.Print(field.Tag.Get("mapstructure") + ": ") + color.Println(v.FieldByName(field.Name)) + } + return nil }, }