Skip to content

Commit

Permalink
Merge pull request #93 from yjinjo/master
Browse files Browse the repository at this point in the history
hange toml to yaml for short names
  • Loading branch information
yjinjo authored Dec 18, 2024
2 parents 6c581b9 + 7625450 commit 3d36dc0
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions cmd/other/shortNames.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ func validateServiceCommand(service, verb, resource string) error {
}

mainV := viper.New()
mainV.SetConfigFile(filepath.Join(home, ".cfctl", "setting.toml"))
mainV.SetConfigType("toml")
mainV.SetConfigFile(filepath.Join(home, ".cfctl", "setting.yaml"))
mainV.SetConfigType("yaml")
if err := mainV.ReadInConfig(); err != nil {
return fmt.Errorf("failed to read config: %v", err)
}
Expand Down Expand Up @@ -208,10 +208,10 @@ func addShortName(service, shortName, command string) error {
return fmt.Errorf("failed to get home directory: %v", err)
}

settingPath := filepath.Join(home, ".cfctl", "setting.toml")
settingPath := filepath.Join(home, ".cfctl", "setting.yaml")
v := viper.New()
v.SetConfigFile(settingPath)
v.SetConfigType("toml")
v.SetConfigType("yaml")

if err := v.ReadInConfig(); err != nil && !os.IsNotExist(err) {
return fmt.Errorf("failed to read config: %v", err)
Expand All @@ -232,10 +232,10 @@ func removeShortName(service, shortName string) error {
return fmt.Errorf("failed to get home directory: %v", err)
}

settingPath := filepath.Join(home, ".cfctl", "setting.toml")
settingPath := filepath.Join(home, ".cfctl", "setting.yaml")
v := viper.New()
v.SetConfigFile(settingPath)
v.SetConfigType("toml")
v.SetConfigType("yaml")

if err := v.ReadInConfig(); err != nil {
return fmt.Errorf("failed to read config: %v", err)
Expand Down Expand Up @@ -266,10 +266,10 @@ func listShortNames() (map[string]interface{}, error) {
return nil, fmt.Errorf("failed to get home directory: %v", err)
}

settingPath := filepath.Join(home, ".cfctl", "setting.toml")
settingPath := filepath.Join(home, ".cfctl", "setting.yaml")
v := viper.New()
v.SetConfigFile(settingPath)
v.SetConfigType("toml")
v.SetConfigType("yaml")

if err := v.ReadInConfig(); err != nil {
if os.IsNotExist(err) {
Expand Down

0 comments on commit 3d36dc0

Please sign in to comment.