Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hange toml to yaml for short names #93

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading