Skip to content

Commit

Permalink
remove unneccessary else-if block
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsgstrabo committed Jan 17, 2024
1 parent 3469680 commit 9750cda
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
13 changes: 13 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,16 @@ func loadConfigFromFile(appFileName string) (*v1.RadixApplication, error) {

return radixApplication, nil
}

func getStringFromFlagValueOrFlagFile(cmd *cobra.Command, valueFlag, fileNameFlag string) (string, error) {
fileName, err := cmd.Flags().GetString(fileNameFlag)
if err != nil {
return "", err
}
if len(fileName) > 0 {
fileContent, err := os.ReadFile(fileName)
return string(fileContent), err
}

return cmd.Flags().GetString(valueFlag)
}
11 changes: 0 additions & 11 deletions cmd/setExternalDnsTls.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,17 +138,6 @@ func isComponentExternalDNSReconciled(apiClient *apiclient.Radixapi, appName, en
return false
}

func getStringFromFlagValueOrFlagFile(cmd *cobra.Command, valueFlag, fileNameFlag string) (string, error) {
if fileName, err := cmd.Flags().GetString(fileNameFlag); err != nil {
return "", err
} else if len(fileName) > 0 {
fileContent, err := os.ReadFile(fileName)
return string(fileContent), err
}

return cmd.Flags().GetString(valueFlag)
}

func init() {
setExternalDnsTlsCmd.Flags().StringP(flagnames.Application, "a", "", "Name of the application")
setExternalDnsTlsCmd.Flags().StringP(flagnames.Environment, "e", "", "Name of the environment")
Expand Down

0 comments on commit 9750cda

Please sign in to comment.