Skip to content

grufelin/anki-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

anki-cli

anki-cli is a Linux-focused command-line tool for working with existing Anki collections, built on top of Anki’s official Python library.

It supports two core operations:

  • add: add one note to an existing deck
  • sync: sync an existing collection to AnkiWeb (media sync enabled by default)

Install

Development

This project uses uv for dependency management.

  • Install dependencies:

    • uv sync
  • Editable installs as a tool with uv:

    • uv tool install -e ./

Usage

Collection selection

You can operate on an Anki collection in one of two ways:

  • Profile mode (recommended): pass --profile NAME (optionally --anki-dir PATH).
  • Collection path mode: pass --collection PATH pointing at collection.anki2 (or a profile folder).

Notes:

  • --profile and --collection are mutually exclusive.
  • If neither is provided, the CLI attempts to find a default profile; if it can’t, it will ask you to pass --profile.

Add a note

Adds exactly one note per invocation. The target deck must already exist.

  • Command:
    • anki-cli add --deck "Deck Name" [--notetype "Basic"] -- <field1_html> <field2_html> ...

Examples:

  • Add a Basic note:
    • anki-cli --profile "User 1" add --deck "Default" -- "Front" "Back"

Sync

Syncs the collection to AnkiWeb.

  • Media sync is enabled by default; disable it with --no-media.

Examples:

  • Sync in profile mode (prompts for credentials if needed and may persist an auth key to Anki prefs):

    • anki-cli --profile "User 1" sync
  • Sync by collection path (requires credentials each run; does not persist them):

    • anki-cli --collection /path/to/collection.anki2 sync --username you@example.com --password "..."

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages