File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
Expand file tree Collapse file tree 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) {
6262func ReadConfig () (Config , error ) {
6363 var result Config
6464
65- viper .AddConfigPath (". " )
65+ viper .AddConfigPath ("$HOME/.commitify " )
6666 viper .SetConfigName ("config" )
6767 viper .SetConfigType ("yaml" )
6868 if err := viper .ReadInConfig (); err != nil {
@@ -75,7 +75,7 @@ func ReadConfig() (Config, error) {
7575}
7676
7777func WriteConfig (config Config ) error {
78- viper .AddConfigPath (". " )
78+ viper .AddConfigPath ("$HOME/.commitify " )
7979 viper .SetConfigName ("config" )
8080 viper .SetConfigType ("yaml" )
8181 configMap := make (map [string ]interface {})
Original file line number Diff line number Diff line change @@ -9,9 +9,14 @@ import (
99
1010func main () {
1111 // configファイルがあるかどうかを確認
12- _ , err := os .Stat ("config.yaml" )
12+ homePath := os .Getenv ("HOME" )
13+
14+ _ , err := os .Stat (homePath + "/.commitify/config.yaml" )
1315 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 {
1520 fmt .Printf ("error creating config file, %s" , err .Error ())
1621 }
1722 }
You can’t perform that action at this time.
0 commit comments