diff options
| author | Paul Buetow <paul@buetow.org> | 2026-04-06 11:12:03 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-04-06 11:12:03 +0300 |
| commit | 616beecc41b573503dad9f5bfd9f353c6f826a8a (patch) | |
| tree | 3189ae3f048dfc4e8ff79b83caab8ea43c2d7492 /internal/cli | |
| parent | 05f54cc0cb8cf3535698ab5027d200842bdb28e3 (diff) | |
refactor: extract shared CardStore into internal/store to eliminate duplication
FindCardDirectory, FindOrCreateCardDirectory, GenerateCardID and the
ScanWords helper previously existed in both internal/utils.go (as
standalone functions) and were partially duplicated in
internal/gui/card_service.go (readWordFromDir, ScanExistingWords).
Introduce internal/store.CardStore as the single source of truth for
all on-disk card-directory operations. Both internal/processor and
internal/gui now hold a *store.CardStore field and delegate to it,
removing the last copy of the directory-scanning loop from
card_service.go. internal/utils.go keeps thin forwarding wrappers for
callers that import the root internal package.
Also adds table-driven unit tests for the new package covering
FindCardDirectory (including legacy _word.txt fallback),
FindOrCreateCardDirectory, and CardStore.ScanWords.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/cli')
0 files changed, 0 insertions, 0 deletions
