mirror of
https://github.com/Slug-Boi/cocommit.git
synced 2026-05-13 12:45:47 +00:00
refactor: author file config
This commit is contained in:
@@ -14,27 +14,26 @@ import (
|
|||||||
// An example of the author file can be found in the examples folder of the repo
|
// An example of the author file can be found in the examples folder of the repo
|
||||||
func Find_authorfile() string {
|
func Find_authorfile() string {
|
||||||
var file string
|
var file string
|
||||||
|
if ConfigVar == nil {
|
||||||
if os.Getenv("author_file") == "" {
|
cfg, _ := LoadConfig()
|
||||||
if ConfigVar == nil {
|
if cfg == nil {
|
||||||
cfg, _ := LoadConfig()
|
// mimic the default config structure
|
||||||
if cfg == nil {
|
cfg = &Config{
|
||||||
// mimic the default config structure
|
Settings: struct {
|
||||||
cfg = &Config{
|
AuthorFile string `mapstructure:"author_file"`
|
||||||
Settings: struct {
|
StartingScope string `mapstructure:"starting_scope"`
|
||||||
AuthorFile string `mapstructure:"author_file"`
|
Editor string `mapstructure:"editor"`
|
||||||
StartingScope string `mapstructure:"starting_scope"`
|
}{
|
||||||
Editor string `mapstructure:"editor"`
|
AuthorFile: "",
|
||||||
}{
|
StartingScope: "git",
|
||||||
AuthorFile: "",
|
Editor: "built-in",
|
||||||
StartingScope: "git",
|
},
|
||||||
Editor: "built-in",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
cfg.SetGlobalConfig()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
cfg.SetGlobalConfig()
|
||||||
|
}
|
||||||
|
|
||||||
|
if os.Getenv("author_file") == "" {
|
||||||
if ConfigVar.Settings.AuthorFile != "" {
|
if ConfigVar.Settings.AuthorFile != "" {
|
||||||
file = ConfigVar.Settings.AuthorFile
|
file = ConfigVar.Settings.AuthorFile
|
||||||
} else if os.Getenv("author_file") != "" {
|
} else if os.Getenv("author_file") != "" {
|
||||||
|
|||||||
Reference in New Issue
Block a user