File tree 2 files changed +9
-4
lines changed
2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ func (c *Config) Config2PbVars() (pb.CodeFormatType, pb.LanguageType) {
62
62
func ReadConfig () (Config , error ) {
63
63
var result Config
64
64
65
- viper .AddConfigPath (". " )
65
+ viper .AddConfigPath ("$HOME/.commitify " )
66
66
viper .SetConfigName ("config" )
67
67
viper .SetConfigType ("yaml" )
68
68
if err := viper .ReadInConfig (); err != nil {
@@ -75,7 +75,7 @@ func ReadConfig() (Config, error) {
75
75
}
76
76
77
77
func WriteConfig (config Config ) error {
78
- viper .AddConfigPath (". " )
78
+ viper .AddConfigPath ("$HOME/.commitify " )
79
79
viper .SetConfigName ("config" )
80
80
viper .SetConfigType ("yaml" )
81
81
configMap := make (map [string ]interface {})
Original file line number Diff line number Diff line change @@ -9,9 +9,14 @@ import (
9
9
10
10
func main () {
11
11
// configファイルがあるかどうかを確認
12
- _ , err := os .Stat ("config.yaml" )
12
+ homePath := os .Getenv ("HOME" )
13
+
14
+ _ , err := os .Stat (homePath + "/.commitify/config.yaml" )
13
15
if os .IsNotExist (err ) {
14
- if _ , err := os .Create ("config.yaml" ); err != nil {
16
+ if err := os .MkdirAll (homePath + "/.commitify" , 0755 ); err != nil {
17
+ fmt .Printf ("error of make directory, %v" , err )
18
+ }
19
+ if _ , err := os .Create (homePath + "/.commitify/config.yaml" ); err != nil {
15
20
fmt .Printf ("error creating config file, %s" , err .Error ())
16
21
}
17
22
}
You can’t perform that action at this time.
0 commit comments