feat: send email

This commit is contained in:
Maas Lalani
2023-06-15 09:45:14 -04:00
parent 5f884c4946
commit daa31dc744
6 changed files with 97 additions and 13 deletions

10
main.go
View File

@@ -1,12 +1,15 @@
package main
import (
"fmt"
"os"
tea "github.com/charmbracelet/bubbletea"
"github.com/spf13/cobra"
)
const RESEND_API_KEY = "RESEND_API_KEY"
var rootCmd = &cobra.Command{
Use: "email",
Short: "email is a command line interface for sending emails.",
@@ -22,6 +25,13 @@ var rootCmd = &cobra.Command{
}
func main() {
key := os.Getenv(RESEND_API_KEY)
if key == "" {
fmt.Printf("\n %s %s %s\n\n", errorHeaderStyle.String(), inlineCodeStyle.Render(RESEND_API_KEY), "environment variable is required.")
fmt.Printf(" %s %s\n\n", commentStyle.Render("You can grab one at"), linkStyle.Render("https://resend.com"))
os.Exit(1)
}
err := rootCmd.Execute()
if err != nil {
os.Exit(1)