fix: exit status 1 when missing environment variable

This commit is contained in:
Maas Lalani 2023-08-01 11:28:17 -04:00
parent 68ec042eb7
commit 65b34a366a
No known key found for this signature in database
GPG key ID: 5A6ED5CBF1A0A000

View file

@ -1,6 +1,7 @@
package main package main
import ( import (
"errors"
"fmt" "fmt"
"io" "io"
"os" "os"
@ -85,7 +86,9 @@ var rootCmd = &cobra.Command{
if deliveryMethod == None { if deliveryMethod == None {
fmt.Printf("\n %s %s %s\n\n", errorHeaderStyle.String(), inlineCodeStyle.Render(ResendAPIKey), "environment variable is required.") fmt.Printf("\n %s %s %s\n\n", errorHeaderStyle.String(), inlineCodeStyle.Render(ResendAPIKey), "environment variable is required.")
fmt.Printf(" %s %s\n\n", commentStyle.Render("You can grab one at"), linkStyle.Render("https://resend.com/api-keys")) fmt.Printf(" %s %s\n\n", commentStyle.Render("You can grab one at"), linkStyle.Render("https://resend.com/api-keys"))
return nil cmd.SilenceUsage = true
cmd.SilenceErrors = true
return errors.New("missing required environment variable")
} }
if hasStdin() { if hasStdin() {