mirror of
https://github.com/Slug-Boi/cocommit.git
synced 2026-05-13 12:45:47 +00:00
refactor: add string function to config struct to allow for extendable printing of future fields
This commit is contained in:
+1
-3
@@ -30,9 +30,7 @@ COMING SOON`,
|
|||||||
} else {
|
} else {
|
||||||
fmt.Println("Current configuration:")
|
fmt.Println("Current configuration:")
|
||||||
}
|
}
|
||||||
fmt.Println("Author File:", utils.ConfigVar.Settings.AuthorFile)
|
fmt.Println(utils.ConfigVar.String())
|
||||||
fmt.Println("Starting Scope:", utils.ConfigVar.Settings.StartingScope)
|
|
||||||
fmt.Println("Editor:", utils.ConfigVar.Settings.Editor)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the config file exists
|
// Check if the config file exists
|
||||||
|
|||||||
@@ -33,6 +33,13 @@ type Config struct {
|
|||||||
} `mapstructure:"settings"`
|
} `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() {
|
func init() {
|
||||||
configDir, err := os.UserConfigDir()
|
configDir, err := os.UserConfigDir()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user