summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorDavid Schlachter <t480-debian-git@schlachter.ca>2026-01-08 11:22:29 -0500
committerDavid Schlachter <t480-debian-git@schlachter.ca>2026-01-08 11:22:29 -0500
commitc540abdd1d1465227e9b6b387570ee5a4d267bf4 (patch)
tree4f16e9caafa0a5c1f1432d0c628358f1314a5814 /main.go
parent63c3a174827aa431237e80bb210166dcd0e186dc (diff)
Make API url configurable
Diffstat (limited to 'main.go')
-rw-r--r--main.go7
1 files changed, 2 insertions, 5 deletions
diff --git a/main.go b/main.go
index 55dc411..9dacd95 100644
--- a/main.go
+++ b/main.go
@@ -13,15 +13,12 @@ import (
_ "github.com/mattn/go-sqlite3"
)
-const (
- apiURL = "http://localhost:8765"
-)
-
func main() {
rawDict := flag.String("rawDictionary", "raw-wiktextract-data.jsonl", "Path to the raw wiktionary data. You can get this by downloading and unzipping https://kaikki.org/frwiktionary/raw-wiktextract-data.jsonl.gz (for French).")
dict := flag.String("dictionary", "dictionary.sqlite3", "Path to the parsed dictionary data. This will be generated from rawDictionary.")
deckName := flag.String("deck", "", "Name of the deck where new Anki cards will be created.")
modelName := flag.String("model", "", "Name of the card type ('model') for new Anki cards.")
+ apiURL := flag.String("apiURL", "http://localhost:8765", "Base URL to access the anki-connect plugin API.")
flag.Parse()
@@ -52,7 +49,7 @@ func main() {
c := http.DefaultClient
c.Timeout = 5 * time.Second
- p := tea.NewProgram(initialModel(c, db, *deckName, *modelName))
+ p := tea.NewProgram(initialModel(c, db, *apiURL, *deckName, *modelName))
if _, err := p.Run(); err != nil {
log.Fatalf("Unexpected error encountered while running program: %s", err)
}