mirror of
https://github.com/Slug-Boi/cocommit.git
synced 2026-05-13 12:45:47 +00:00
refactor: redudandant
This commit is contained in:
@@ -36,14 +36,11 @@ func Find_authorfile() string {
|
|||||||
if os.Getenv("author_file") == "" {
|
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") != "" {
|
|
||||||
file = os.Getenv("author_file")
|
|
||||||
} else {
|
} else {
|
||||||
userconf, err :=os.UserConfigDir()
|
userconf, err :=os.UserConfigDir()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(fmt.Sprintf("Error getting user config dir: %v", err))
|
panic(fmt.Sprintf("Error getting user config dir: %v", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := os.Stat(userconf+"/cocommit/authors.json"); os.IsNotExist(err) {
|
if _, err := os.Stat(userconf+"/cocommit/authors.json"); os.IsNotExist(err) {
|
||||||
panic(fmt.Sprintf("No author file set, please set the author_file environment variable or create a config file using the command: cocommit config -c"))
|
panic(fmt.Sprintf("No author file set, please set the author_file environment variable or create a config file using the command: cocommit config -c"))
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user