refactor: add string function to config struct to allow for extendable printing of future fields

This commit is contained in:
Slug-Boi
2025-08-18 13:24:42 +02:00
parent ab3f16be4a
commit 01c6581027
2 changed files with 8 additions and 3 deletions
+1 -3
View File
@@ -30,9 +30,7 @@ COMING SOON`,
} else {
fmt.Println("Current configuration:")
}
fmt.Println("Author File:", utils.ConfigVar.Settings.AuthorFile)
fmt.Println("Starting Scope:", utils.ConfigVar.Settings.StartingScope)
fmt.Println("Editor:", utils.ConfigVar.Settings.Editor)
fmt.Println(utils.ConfigVar.String())
}
// Check if the config file exists
+7
View File
@@ -33,6 +33,13 @@ type Config struct {
} `mapstructure:"settings"`
}
func (c *Config) String() string {
return fmt.Sprintf("Author File: %s\nStarting Scope: %s\nEditor: %s",
c.Settings.AuthorFile,
c.Settings.StartingScope,
c.Settings.Editor)
}
func init() {
configDir, err := os.UserConfigDir()
if err == nil {