From c540abdd1d1465227e9b6b387570ee5a4d267bf4 Mon Sep 17 00:00:00 2001 From: David Schlachter Date: Thu, 8 Jan 2026 11:22:29 -0500 Subject: Make API url configurable --- main.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'main.go') 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) } -- cgit v1.2.3