From 7a3ed3d95542fbebe365ed53297ef38a4a530bf3 Mon Sep 17 00:00:00 2001 From: Arya Kiran Date: Wed, 18 Jan 2023 22:46:09 +0530 Subject: [PATCH] retrieve username from args instead of envfile --- examples/meta-info.env | 1 - main.go | 9 +++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/meta-info.env b/examples/meta-info.env index 4eee8fa..87d3454 100644 --- a/examples/meta-info.env +++ b/examples/meta-info.env @@ -1,4 +1,3 @@ -USERNAME=testuser FULL_NAME="Test User" GEMINI_CAPSULE=gemini://test.com WEBSITE=https://test.com diff --git a/main.go b/main.go index 3fff05b..1fbb277 100644 --- a/main.go +++ b/main.go @@ -20,12 +20,12 @@ type Userstruct struct { type Userinfo struct { Name string `json:"name"` FullName string `json:"fullName"` - Loc string `json:"loc"` - Email string `json:"email"` Desc string `json:"desc"` + Online bool `json:"online"` + Email string `json:"email"` Website string `json:"website"` Capsule string `json:"capsule"` - Online bool `json:"online"` + Loc string `json:"loc"` } func Dedup(input string) string { @@ -60,6 +60,7 @@ func userdata(username, usersonline string) Userinfo { if os.IsNotExist(error) { log.Error(username + " does not have a meta-info.env") var user Userinfo + user.Name = username if strings.Contains(usersonline, " "+username) == true { user.Online = true } else { @@ -71,7 +72,7 @@ func userdata(username, usersonline string) Userinfo { viper.SetConfigFile(filename) viper.ReadInConfig() var user Userinfo - user.Name = viper.GetString("USERNAME") + user.Name = username user.FullName = viper.GetString("FULL_NAME") user.Capsule = viper.GetString("GEMINI_CAPSULE") user.Website = viper.GetString("WEBSITE")