From e934aa5a92c0523a42429e25ff5e64814a7094ae Mon Sep 17 00:00:00 2001 From: Arya Kiran Date: Wed, 18 Jan 2023 22:20:51 +0530 Subject: [PATCH] fixed user attributes for /users --- TODO.md | 1 - main.go | 38 +++++++++++++++++++------------------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/TODO.md b/TODO.md index 3925ce6..b6dbda7 100644 --- a/TODO.md +++ b/TODO.md @@ -1,3 +1,2 @@ # TODO -- Get Users attribute to work correctly diff --git a/main.go b/main.go index 1a82320..5825a39 100644 --- a/main.go +++ b/main.go @@ -18,14 +18,14 @@ type Userstruct struct { Users []Userinfo } type Userinfo struct { - name string - fullname string - loc string - email string - desc string - website string - capsule string - online bool + Name string + FullName string + Loc string + Email string + Desc string + Website string + Capsule string + Online bool } func Dedup(input string) string { @@ -61,9 +61,9 @@ func userdata(username, usersonline string) Userinfo { log.Error(username + " does not have a meta-info.env") var user Userinfo if strings.Contains(usersonline, " "+username) == true { - user.online = true + user.Online = true } else { - user.online = false + user.Online = false } return user } @@ -71,17 +71,17 @@ func userdata(username, usersonline string) Userinfo { viper.SetConfigFile(filename) viper.ReadInConfig() var user Userinfo - user.name = viper.GetString("USERNAME") - user.fullname = viper.GetString("FULL_NAME") - user.capsule = viper.GetString("GEMINI_CAPSULE") - user.website = viper.GetString("WEBSITE") - user.desc = viper.GetString("DESCRIPTION") - user.email = viper.GetString("EMAIL") - user.loc = viper.GetString("LOCATION") + user.Name = viper.GetString("USERNAME") + user.FullName = viper.GetString("FULL_NAME") + user.Capsule = viper.GetString("GEMINI_CAPSULE") + user.Website = viper.GetString("WEBSITE") + user.Desc = viper.GetString("DESCRIPTION") + user.Email = viper.GetString("EMAIL") + user.Loc = viper.GetString("LOCATION") if strings.Contains(usersonline, " "+username) == true { - user.online = true + user.Online = true } else { - user.online = false + user.Online = false } return user }