Skip to content
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
27 changes: 18 additions & 9 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,28 @@ non-interactively on the CLI by providing all required flags:

See "pop skill" for a full skill definition for AI agents.`,
RunE: func(cmd *cobra.Command, _ []string) error {
// We'll use this to print to stderr and downsample colors on the way,
// if needed.
errWriter := colorprofile.NewWriter(os.Stderr, os.Environ())

if smtpPassword != "" && smtpUsername == "" {
err := errors.New("SMTP password provided without an SMTP username")
cmd.SilenceUsage = true
cmd.SilenceErrors = true
_, _ = fmt.Fprintf(errWriter, "\n %s %s\n\n", errorHeaderStyle.String(), err)
return err
}
smtpEnabled := smtpHost != "" || smtpUsername != ""

var deliveryMethod DeliveryMethod
switch {
case resendAPIKey != "" && smtpUsername != "" && smtpPassword != "" && oauthResend:
case resendAPIKey != "" && smtpEnabled && oauthResend:
deliveryMethod = Unknown
case resendAPIKey != "" && smtpUsername != "" && smtpPassword != "":
case resendAPIKey != "" && smtpEnabled:
deliveryMethod = Unknown
case resendAPIKey != "" && oauthResend:
deliveryMethod = Unknown
case smtpUsername != "" && smtpPassword != "" && oauthResend:
case smtpEnabled && oauthResend:
deliveryMethod = Unknown
case resendAPIKey != "":
deliveryMethod = Resend
Expand All @@ -135,9 +148,9 @@ See "pop skill" for a full skill definition for AI agents.`,
}
resendAPIKey = token
deliveryMethod = Resend
case smtpUsername != "" && smtpPassword != "":
case smtpEnabled:
deliveryMethod = SMTP
if from == "" {
if from == "" && smtpUsername != "" {
from = smtpUsername
}
default:
Expand All @@ -157,10 +170,6 @@ See "pop skill" for a full skill definition for AI agents.`,
}
}

// We'll use this to print to stderr and downsample colors on the way,
// if needed.
errWriter := colorprofile.NewWriter(os.Stderr, os.Environ())

{
const gap = " "

Expand Down