refactor: consolidate app name verification into golang binary

This change ensures we only have to change this logic once in order to get them to apply to both languages in the codebase.
This commit is contained in:
Jose Diaz-Gonzalez
2022-05-29 11:28:34 -04:00
parent cc9d76aa11
commit db4d8dba88
3 changed files with 18 additions and 34 deletions

View File

@@ -61,6 +61,19 @@ func LogFailWithError(err error) {
os.Exit(1)
}
// LogFailWithErrorQuiet is the failure log formatter (with quiet option)
// prints text to stderr and exits with the specified exit code
// The error message is not printed if DOKKU_QUIET_OUTPUT has any value
func LogFailWithErrorQuiet(err error) {
if os.Getenv("DOKKU_QUIET_OUTPUT") == "" {
fmt.Fprintln(os.Stderr, fmt.Sprintf(" ! %s", err.Error()))
}
if errExit, ok := err.(ErrWithExitCode); ok {
os.Exit(errExit.ExitCode())
}
os.Exit(1)
}
// LogFailQuiet is the failure log formatter (with quiet option)
// prints text to stderr and exits with status 1
func LogFailQuiet(text string) {