All Projects → davidshepherd7 → ankicli

davidshepherd7 / ankicli

Licence: AGPL-3.0 license
Proof-of-concept command line interface for managing Anki decks.

Programming Languages

python
139335 projects - #7 most used programming language

Ankicli

A command line interface for managing Anki decks.

This is a proof-of-concept version which is only capable of adding new cards to your decks from a simple text file format. It is unlikely to go any further because I've moved to using anki-mode to create cards directly inside Emacs.

For creating anki cards from text files on the command line, you might want to check out org_to_anki which seems to be more active.

Installation

  1. Install python3 and pip (for python3), e.g. with sudo apt install python3 python3-pip.
  2. Install anki-connect (anki addon 2055492159) and restart Anki
  3. Clone this repository
  4. Run pip3 install -r requirements.txt in the project root directory

Usage

Example: from the project root directory run

./bin/anki-cli --card_file docs/example-card.txt

Run with -h for more details on other options.

Markdown example:

./bin/anki-cli --markdown --card_file docs/example-card.md

File format

The @ character at the beginning of a line is used to mark the name of a field. Everything else on the line is used as the field name (with leading and trailing whitespace removed), everything from the next line until the start of the next field is used as the contents of the field.

For example a standard "Basic" card type would be written as:

@Front
What is a foo?
@Back
A particularly vicious variety of dandelion.

No other parsing or modification is done, so html, cloze deletions, LaTeX, etc. should all work as normal.

Licence

The current licence is AGPLv3 because that's what Anki uses and consistent licencing is nice. If you would like something less restrictive give me a shout.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].