flashy

Crates.ioflashy
lib.rsflashy
version0.1.0
sourcesrc
created_at2024-07-30 13:35:41.288049
updated_at2024-08-13 09:07:09.52613
descriptionA TUI to write and use flashcards
homepage
repositoryhttps://gitlab.com/haasal/flashy-rs
max_upload_size
id1319796
size181,897
Alexander Haas (haasal)

documentation

README

Flashy

!!! The project is still in early development so expect breaking changes !!!

A flashcard TUI written in Rust that supports Anki styled repetition and writing flashcards in TOML.

Features

  • Extensive CLI to manage decks, reviews and flashcards
  • Terminal UI (TUI) to review cards using fsrs spaced repetition
  • Write flashcards in any config format
    • Currently available: json and toml but very easily extensible to formats that implement serde
    • Easy import and merge into existing cards
    • Export data into all supported config formats

I used fsrs (SR scheduling), ratatui (UI) and clap (CLI).

Installation

# clone this repo
git clone https://gitlab.com/haasal/flashy-rs
cd flashy-rs
cargo run -- help

Usage

This project consists of a CLI and a TUI. The CLI is used to import flashcard files, add new flashcards and start the UI.

Adding cards through CLI

cargo run -- new deck --name "my-deck"
cargo run -- new flashcard --deck "my-deck" -q "Question..." -a "Answer..."
cargo run -- new flashcard --deck "my-deck" -q "Question 2..." -a "Answer 2..."
cargo run -- ui --deck "my-deck" # Start the TUI

Loading decks from config file

Create file my-cards.toml:

[[decks]]
name = "Deck 1"

[[decks.cards]]
q = "Question 1"
a = "Answer 1"

[[decks.cards]]
question = "Question 2"
answer = "Answer 2"

[[decks.cards]]
q = "Question 4"
a = "Answer 4"

[[decks]]
name = "Deck 2"
description = "Description 2"

[[decks.cards]]
q = "Question 3"
a = "Answer 3"

Import the deck into the database

cargo run -- file --import -f "my-deck.toml"

Review cards in Deck 1

cargo run -- ui --deck "Deck 1"

Make change to my-config.toml and reimport like above. Reviews are not overwritten.

Contributing

I'm happy you want to contribute! PRs and issues are very welcome. Please create an issue before beginning to work on a PR so the changes can be discussed beforehand. Take a look at the CONTRIBUTING.md for more info. Please take a look at the TODOs below if you need inspiration ;)

TODOs

Chores/Fixes

  • Better logging (i.e. return deleted flashcards, ...)
  • Proper error messages instead of raw sql error
  • Log warnings on duplicate questions and upserts
  • Add delete flag for file --import so that decks are mapped 1:1 into db
  • Add tests...
  • Use this algo for spaced repetition
  • More elegant way of displaying controls (directly coupled to actual controls or sth)
  • Only show due flashcards
  • Order flashcards by due date (due in front)
  • Cut down on the unfortunately massive amount of dependencies (mainly caused by missing feature flags in fsrs-rs)
  • Move database to predefined config folder so one can run this outside the project directory
  • Create pipelines (CI/CD)
  • Specify development environment (clippy, formatting etc.)
  • Better documentation
  • Code cleanup and refactor
  • GitLab flags in readme (Crates.io etc.)

Features

  • Ascii-math as UTF-8 support
  • More config formats
  • Write/Render flashcards in markdown
  • Create Flashcards in the ui
  • Integrate toggleable logging windows into Ui
  • Training fsrs-rs parameters
  • Remove rating from db
  • Colorize easy, hard, ...
  • Plugin support
  • Configuration options
Commit count: 0

cargo fmt