Terminal based flash-card program
|
11 hónapja | |
---|---|---|
lib | 11 hónapja | |
COPYING | 11 hónapja | |
README.md | 11 hónapja | |
tanki.rb | 11 hónapja |
Tanki is a terminal flashcard program written in ruby. I wanted a simple alternative to Anki that ran in the terminal, thus tanki was born.
Tanki works by parsing files inside ~/.tanki. Cards are files with .cards suffix. Cards are put inside decks, which are just folders containing cards. Decks can be nested to your heart's content.
Here is an example of the syntax:
# A card about Franz-Ferdinand
%
When arch-duke Franz-Ferdinand was killed?
%
28 June 1914
The first % marks the beginning of the prompt and the second indicates the start of the answer. Everything after a # is comment. If you want to input a hashtag, escape it ('\#').
After you read a card, tanki will append the following two lines to the card's source:
# Values for internal tanki use, dont touch them unless you know what you're doing
Stage: 1
LastReview: 2024-05-06
This is some metadata regarding the card. Stage indicates your review stage and LastReview contains the last time you saw this card. Internally, tanki uses these two values to compute the ealiest date that the card will be marked as pending.
The stage number is an position on the following sequence:
0 1 1 2 2 3 3 4 4...
The value in the sequence is then added to the date to find out the when the next review should occur.
As you can see, the spacing algorithm is very simple, though that really shouldn't matter. Research seems to indicate that the complexity of the spacing algorithm tends to not matter much.
There is not much that can go wrong in a card. Nevertheless mangled metadata or a missing % can render it unparseable. In that case, you will have to fix it by hand. Mangled metadata can be fixed by deleting the current one and letting tanki add it back again, but you will lose your progress.
Calling tanki without arguments will trigger a review of all pending cards.
You can review only specific cards or decks by passing the '-c' (for cards) or the '-d' (for decks) arguments followed by the cards or decks you wish to review. These arguments can be combined and there viewed cards will be union of all the cards found.
You can also use the '-i' flag to skip cards that contains errors, otherwise tanki will refuse to startup.
First, you need to have ruby installed and have a copy of the code (download it here). Installing is left as a matter of taste, I particularly put the repo inside ~/.local/share:
mv tanki .local/share
and them create a symbolic link to it inside ~/.local/bin.
mkdir ~/.local/bin
ln -s ~/.local/share/tanki.rb ~/.local/bin/tanki
To add ~/.local/bin to your PATH, if you haven't already, Add the following line to your ~/.bash_profile
export PATH="$HOME/.local/bin:$PATH"
This will only work when you restart your session, but you can execute that same line in your terminal instance to start using tanki immeditately.