summaryrefslogtreecommitdiff
path: root/add.go
diff options
context:
space:
mode:
authorDavid Schlachter <t480-debian-git@schlachter.ca>2026-01-08 01:47:49 -0500
committerDavid Schlachter <t480-debian-git@schlachter.ca>2026-01-08 01:47:49 -0500
commit608e12a601d32797d93a550ac9b33d446f38bf55 (patch)
treee76cb88422546613891795f3ae2079ca0cd57ad9 /add.go
parentb21350357e8471952d2bd15d15ea77220d3caf21 (diff)
Add colors so it's easier to read
Diffstat (limited to 'add.go')
-rw-r--r--add.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/add.go b/add.go
index 2b358fe..67427df 100644
--- a/add.go
+++ b/add.go
@@ -3,6 +3,7 @@ package main
import (
"bytes"
"encoding/json"
+ "errors"
"fmt"
"io"
"net/http"
@@ -42,6 +43,13 @@ type options struct {
func addCard(c *http.Client, front, back string) tea.Cmd {
return func() tea.Msg {
+ if back == "" {
+ return errMsg(errors.New("definition is blank"))
+ }
+ if front == "" {
+ return errMsg(errors.New("word is blank"))
+ }
+
noteRequest := addNote{
Action: "addNote",
Version: apiVersion,